Code24Lab
Databases & SQL Beginner

SQL Server T-SQL Foundations: Queries, Functions & Basic DML

Read and predict real T-SQL on a fictional bike shop database: SELECT TOP, OFFSET-FETCH, ISNULL, CAST and CONVERT, TRY_CAST, DATEADD and DATEDIFF, string functions, CASE, GROUP BY, HAVING, IDENTITY and INSERT, UPDATE, DELETE, with every answer checked as you go.

22 lessons 22 labs Certificate

  • One-time payment
  • Instant access right after payment
  • Secure checkout with Stripe

About this course

T-SQL Foundations teaches you to read and predict real SQL Server queries. You work with a small fictional bike shop database, with products, orders and a few helper tables, and in every lab you work out exactly what a query returns: which rows TOP and OFFSET-FETCH keep, what ISNULL and COALESCE do with NULL, where CAST truncates and where it rounds, why int division and AVG on an int column lose decimals, how DATEADD clamps to the month end and why DATEDIFF counts boundaries. You also use string functions, CASE, GROUP BY and HAVING, predict IDENTITY values, and see what INSERT, UPDATE, DELETE and TRUNCATE change. Every answer is checked instantly, and the first lesson is free.

Lessons

  1. SELECT, FROM dbo and Calculated ColumnsLabFree
  2. WHERE: Comparisons, BETWEEN and ANDLab Locked
  3. SELECT TOP, ORDER BY and WITH TIESLab Locked
  4. ORDER BY and OFFSET-FETCH PagingLab Locked
  5. NULL, ISNULL and COALESCELab Locked
  6. Variables, Integer Division and ModuloLab Locked
  7. CAST and CONVERT: Types, Truncation and RoundingLab Locked
  8. TRY_CAST: Converting Dirty Data Without ErrorsLab Locked
  9. Dates: GETDATE, MONTH, DATEPART and EOMONTHLab Locked
  10. DATEADD: Due Dates, Return Windows and Month EndsLab Locked
  11. DATEDIFF: Counting Boundaries, Not DurationsLab Locked
  12. String Functions: LEFT, RIGHT, LEN and TRIMLab Locked
  13. CHARINDEX, SUBSTRING and CONCAT vs +Lab Locked
  14. CASE and IIF: Labels and Conditional SumsLab Locked
  15. Aggregates: COUNT, SUM, AVG and the Integer AVG TrapLab Locked
  16. GROUP BY: One Row per GroupLab Locked
  17. HAVING vs WHERE and the Logical Query OrderLab Locked
  18. Grouping by Month and Where Aliases WorkLab Locked
  19. INSERT and IDENTITY: Automatic Keys and GapsLab Locked
  20. UPDATE: Changing Rows SafelyLab Locked
  21. DELETE vs TRUNCATELab Locked
  22. Final Project: Top Customers ReportLab Locked