Archive for the ‘SQL Queries’ Category

SQL Server Email Alerts Notifications

As  DBAs, we are often required to set up alert notification emails for various tasks. For example, there might be a requirement to set up notification alerts if a particular backup job fails. A while back, I  came across the situation where I was asked to write a script which sent an email alert to […]

A Check and Foreign Key Constraint Improves Query Performance

In one of my training sessions I was asked, can check and foreign key constrain improve query performance? The answer to this question is ‘Yes’ and I will show you how in this article. The optimizer uses foreign key constrains and check constraints to create more efficient query plan by skipping some part of the […]

Hierarchies in SQL

Department management hierarchies. Bills of materials. Sales regions and offices. Data access levels. All of these and more are things that require storing hierarchical data in a database. First, any mention of this subject needs to carry with it a mention of Joe Celko and his work on "nested sets" hierarchies. He has an excellent […]

Binary Trees in SQL

A number of hierarchies and networks are¬†most convenently¬†modelled as binary trees. So what is the best way of representing them in SQL? Joe discards the Nested Set solution in favour of surprisingly efficient solution based on the Binary Heap. It made me pause to think: I’d been scanning the forums of SQL Server Central when […]

Powered by WordPress | Compare Cell Phone Plans at | Thanks to Cheap Palm Pixi, Bromoney and Wordpress Themes