Skip to main content
Databases

SQL Server Tutorial with Examples.

SQL Server tutorial: T-SQL, stored procedures, SSMS, indexing strategies and enterprise database administration on Microsoft SQL Server.

Beginner

Start here — no prior experience needed

1 lesson

Intermediate

For developers with core concepts down

5 lessons
sqlserver intermediate
5 min read

Forcing SQL Server to use a nonclustered index costs 217 logical reads -- worse than the 40-read scan it was supposed to beat -- because every matching row needs a separate key lookup. INCLUDE fixes it at 4 reads.

sqlserver intermediate
5 min read

RANK() and DENSE_RANK() handle a three-way tie for first place completely differently from each other and from ROW_NUMBER() -- and none of the three can be filtered directly in WHERE, a real Invalid column name error proves it.

sqlserver intermediate
5 min read

A recursive CTE generating a date series past 100 rows fails with Msg 530 by default -- SQL Server caps recursion depth at 100 unless OPTION (MAXRECURSION n) says otherwise.

sqlserver intermediate
5 min read

READ UNCOMMITTED reads an uncommitted price change mid-transaction -- then the transaction rolls back, and the value never really existed. The default READ COMMITTED blocks instead, confirmed with a real timeout.

sqlserver intermediate
5 min read

A trigger reading `inserted` into scalar variables works fine for a single-row insert -- and silently audits only one of two rows on a multi-row insert, because a trigger fires once per statement, not once per row.

Advanced

Production-grade patterns for experienced engineers

1 lesson

Also part of SQL Server

Taught in other topics. Each link opens the lesson in its home topic.

1 lesson