I gave 40 candidates this puzzle: get the top N records per group from a student marks table. Here is the simple answer using a Ranking Function.
SQL SERVER – 2017 – How to Remove Leading and Trailing Spaces with TRIM Function?
TRIM finally arrived in SQL Server 2017. Here is how to remove leading and trailing spaces with the new TRIM function, in a few simple words.
Building Demo Data With GENERATE_SERIES
Build demo data with GENERATE_SERIES, weighted categories, customer skew, random amounts, and validation that preserves repeatable tests.
When to Use IDENT_CURRENT? – Interview Question of the Week #150
When should you use IDENT_CURRENT instead of SCOPE_IDENTITY()? A question I heard at the Group By conference, answered with the key difference.
How to Assign Multiple Variables in a Single T-SQL Query? – Interview Question of the Week #148
How do you assign Multiple Variables in a single T-SQL query? Here are three ways, from separate SET statements to my preferred one-line style.
How to Validate Email Address in SQL Server? – Interview Question of the Week #147
How do you validate an Email Address in SQL Server? Here is a simple query that separates valid addresses from invalid ones in a sample table.
SQL SERVER – Puzzle – Shortest Code to Produce the Number 1000000000 (One Billion)
After 700 answers to my zero puzzle, here is the next one: write the shortest code to produce 1000000000 without typing it or using arithmetic operators.






