SQL SERVER – How to Write Correlated Subquery?

This is a follow-up blog post to my earlier blog post written about SQL SERVER – Writing Your First Subquery From a Single Table. In the blog post, we discuss how to write a correlated subquery and why it is actually necessary. In a query, a correlated subquery is a subquery that uses values from the outer query. Subqueries are usually running once for each row processed for outer query and that is why they are often inefficient as well.

Read More

SQL SERVER – Writing Your First Subquery From a Single Table

My primary responsibility is to help different organizations with tuning their SQL Server Performance and here is the link to my most popular service SQL Server Performance Health Check. I often encounter complicated performance problems which are not easy to resolve, however, recently during the lunch break, I was asked by Junior developer a question about writing a subquery from a single table by a Junior DBA at the organizations.

Read More

SQL SERVER – Information Message: Cannot shrink file in database to xxxx pages as it only contains yyyy pages.

I often get emails from my blog readers asking various types of clarifications about my own blog. Here is one of the interesting questions from a reader about message Cannot shrink file in the database to xxxx pages as it only contains yyyy pages which he encountered after following my below blog.

Read More