TSQL for Beginners: Week 1

Welcome to TSQL for Beginners!

In this first session of the course, we cover:

  • Getting going in SQL Server Management Studio or in Azure Data Studio
  • Using databases
  • SELECT statements and aliasing
  • Bonus topic: What does ‘deprecated’ mean?

This session walks through the script 1_SelectAndAlias_Demo.sql.

Your homework for the next session is to try your hand at the 2_SelectAndAlias_Homework.sql script.

Video timeline:

  • 00:22 Course Syllabus
  • 02:10 Notes on what to install to follow along
  • 07:00 Basics on using SQL Server Management Studio (SSMS)
  • 08:00 Info about the RAISERROR command I use at the top of the scripts
  • 09:49 Using the RESTORE DATABASE script
  • 16:11 Azure Data Studio (ADS) – why you might want to use this and comparing ADS to SSMS
  • 17:44 Explanation of ‘USE’ and discussion of the concept of “using a database”
  • 20:24 Running our first SELECT statement
  • 22:24 Brief overview of schemas
  • 23:15 Discussion of GO batch separator
  • 25:30 Discussion of semi-colon terminators
  • 27:34 Why “SELECT *” is an anti-pattern
  • 32:05 A brief return to SSMS to demo dragging object names and column names over from Object Explorer (this doesn’t work in Azure Data Studio, but it does have good object auto-completion for typing)
  • 35:28 What square [brackets] do around object names, and how they can allow you to use special characters (with a “stupid pet trick” demo of how to create a database with a space as its name)
  • 39:00 Example of using a column alias with ‘AS’
  • 40:48 Discussion of when you want to use a column alias and why
  • 41:20 Demo of aliasing without the word ‘AS’ – and a warning of how this can be done accidentally
  • 43:09 Demo of aliasing with reversed order and “=” (and a little discussion of ANSI compliance)
  • 47:43 A quick step through of the “quiz” questions in the demo file
  • 51:17 Demo of aliasing a table, and comparing three and two part names
  • 53:30 Recap of the “quiz” questions on table name aliasing
  • 56:08 Brief introduction of next week’s homework