From the course: Microsoft SQL Server 2022 Essential Training
Understand the role of T-SQL - SQL Server Tutorial
From the course: Microsoft SQL Server 2022 Essential Training
Understand the role of T-SQL
- [Instructor] Structured Query Language, or SQL, is the language that we use to talk to our database server. The language has been around for a very long time, having been adopted by the American National Standards Institute, or ANSI, way back in 1986. Every relational database management system on the market today uses some form of the SQL language. Though some adhere to the standard syntax closer than others. Because Microsoft has built some unique and differentiating features into SQL Server, they've had to slightly modify the language away from strict ANSI compliance. Today, Microsoft's version of the language is called Transact-SQL or T-SQL. Everything that we've done so far in Management Studio has been performed on the server using the T-SQL language. Here's an example of the code that builds the same orders table that we added to the Red30 Tech database. When we build the table using the graphical design interface, Management Studio converts those instructions into this code for us behind the scenes. At some point, it just makes sense to take our skills beyond the tools presented in the graphical user interface and start writing this code ourselves. That's what this chapter is all about. Before we jump in though, I'd like to point you to this Transact-SQL reference documentation. I highly recommend that you bookmark this page as you'll want to refer to it early and often. Whenever you have a question about writing a T-SQL statement, this reference should be your first stop. On the left side of this page are different chapters within the documentation that will help you reference specific topics. Specifically, if I scroll down here, I can find this section on queries and open that up. This section will cover many of the clauses that we'll see over the next few movies to ask questions about your data. There's also a section on functions. Let me go ahead and scroll up to that. This will document how to use the built-in functions that perform calculations within the database or return information from the server. For instance, if I scroll through the function section and get to the date time functions, and expand that, and come down and find the function for GETDATE, we'll see how to use this specific function to return the system date and time from the database. We used this function when we created the timestamped default value in the Red30 Tech Products Table. So bookmark these pages. You'll want them easily accessible as you continue to work with SQL Server.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
Understand the role of T-SQL2m 40s
-
(Locked)
Use the T-SQL editor6m 49s
-
(Locked)
Create a table with T-SQL6m 33s
-
(Locked)
Solution: Create tables with T-SQL commands3m 46s
-
(Locked)
Add data to a table4m 58s
-
(Locked)
Solution: Add data with T-SQL commands3m 4s
-
(Locked)
Retrieve records with SELECT4m 3s
-
(Locked)
Solution: Query data in a database2m 7s
-
(Locked)
Filter returned results with WHERE3m 12s
-
(Locked)
Sort records2m 54s
-
(Locked)
Solution: Filter and sort data with a query4m 27s
-
(Locked)
Delete records from a table4m 31s
-
(Locked)
Update records in a table2m 3s
-
(Locked)
Solution: Remove and update records in a table6m 11s
-
(Locked)
Joining related tables4m 32s
-
(Locked)
Solution: Query information from related tables5m 33s
-
(Locked)
Remove a table from the database5m 7s
-
-
-
-
-
-