Chapter 3. T-SQL crash course

 

SQL Server operates using a language called Transact-SQL (T-SQL). It’s a Microsoft-specific variation of the industry-standard Structured Query Language, or SQL. T-SQL is compliant with the industry-standard SQL elements, and adds its own features for things like server management and schema definition. While much of SQL Server can be operated using the GUI, SQL Server’s real power lies in T-SQL (some of the GUI runs T-SQL under the hood). In this chapter, we’ll explore some of the basic data manipulation language (DML) queries in T-SQL.

It’s difficult to understand a lot of how SQL Server works, and even difficult to really work with SQL Server, without knowing a little bit about T-SQL. However, I don’t have a goal in this book of trying to make you a T-SQL programmer. So I’m going to go through some of the major T-SQL queries in this compact chapter. That way, you’ll get the context you need for much of the rest of the book to make sense, but I won’t bog you down with stuff that isn’t directly related to the goal of effectively maintaining SQL Server.

3.1. SELECT queries

A SELECT query is designed to retrieve data from a database. It’s the most common of the four basic DML queries (the others being DELETE, UPDATE, and INSERT), and it’s one you’ll use a lot as you work with SQL Server.

3.2. DELETE, UPDATE, and INSERT queries

3.3. Assessing a database’s structure

3.4. Multitable SELECT queries

3.5. Hands-on lab