This month's discount Comprehensive Database Performance Health Check · Testimonials
SQLAuthority with Pinal Dave
Home
  • Consulting
    • Health Check
  • Free Videos
  • All Articles
    • AI
    • SQL Performance
    • SQL Tips and Tricks
    • Interview Questions and Answers
    • SQL Puzzle
    • SQL Video
    • SQLAuthority News
    • Personal
  • Books
  • Consulting
A hand tying one ribbon to each blackberry bush along a lane that has at least one ripe berry.

EXISTS vs IN vs JOIN: Writing Semi-Joins

June 1, 2024
Pinal Dave
SQL Performance
SQL Joins, SQL NULL, SQL Server, SQL Sub Query

Compare EXISTS, IN, and JOIN for semi-joins, prevent duplicate customer rows, and handle NULL safely in exclusion queries.

Read More
topearner1

Finding Top Earners: A T-SQL Challenge in SQL Server

July 4, 2023
Pinal Dave
SQL Tips and Tricks
CTE, SQL Sub Query

The goal is to find the top three highest-paid (top earners) employees in each department and their corresponding department details.

Read More
CumulativeTotalCalculation

SQL SERVER Challenge – Cumulative Total Calculation

June 16, 2023
Pinal Dave
SQL Interview Questions and Answers
Contest, CTE, Ranking Functions, SQL Scripts, SQL Sub Query

Today we will see a very interesting SQL SERVER Challenge about Cumulative Total Calculation. During a recent Comprehensive Database Performance Health Check.

Read More
Five wooden cups on a felt table, four turned up empty and one still covered.

NOT IN With a NULL in the List Returns No Rows

April 8, 2021
Pinal Dave
SQL Tips and Tricks
SQL NULL, SQL Operator, SQL Server, SQL Sub Query

See why NOT IN with a NULL returns no customers, then compare five sample rows, NOT EXISTS, an IS NOT NULL filter, and query plans.

Read More
A hand carrying three drinks and a plate on one wooden tray across a cafe terrace, worn gravel paths behind.

Rewriting Correlated Subqueries as Window Functions

October 31, 2020
Pinal Dave
SQL Tips and Tricks
Ranking Functions, SQL Function, SQL Performance, SQL Server, SQL Sub Query

Replace correlated subqueries with windowed counts, dates, and running totals, preserve detail rows, and keep useful EXISTS filters.

Read More
A cork puller beside two evenly sealed bottles and one raised tilted cork

Assertion Queries: Data Checks That Should Return Zero Rows

March 22, 2014
Pinal Dave
SQL Tips and Tricks
SQL Constraint and Keys, SQL Sub Query, Testing

Let a short query find the order with no lines before a customer does. A small demo shows the failing keys, constraint error 547 and a clean repair.

Read More
A basketball net above a basketball with a different practice ball kept outside

Makers That Sell PCs but Not Laptops: HAVING With Conditional Counts

February 25, 2014
Pinal Dave
SQL Tips and Tricks
SQL CASE, SQL Group By, SQL Sub Query

One WHERE clause cannot say ‘has a PC but no laptop’. Here are three queries that can, and the NULL trap.

Read More
1 2 3 Next
  • Books
  • Testimonials
  • Privacy Policy

© 2006 – 2026 All rights reserved. pinal @ SQLAuthority.com