T-SQL tutorial: Creating a database

The first thing you will need to do after installing SQL Server is creating a database, tables and inserting data into these tables. This is the most boring lesson, but it is necessary to do the next exercises.


After creating a database and tables we can start learning the basics of T-SQL. In this lesson you will learn a few things: unnamed blocks, comments, variables, expression, parameters, assigning query results to variables, CASE function, WHILE, BREAK, CONTINUE.


View is a virtual table whose columns and rows are defined by a query. The two most important aspects of views are-
  1. To focus, simplify, and customize the perception each user has of the database.
  2. As a security mechanism by allowing users to access data through the view, without granting the users permissions to tables.

Stored procedures

The real power of T-SQL language is really the ability to create stored procedures. Stored procedures are executable objects stored in a database (one or more SQL statements that have been precompiled into a single executable procedure).

User-Defined Functions

If you can create procedures, you can also create functions. You can create the function once, store it in the database, and call it any number of times in your application. User-defined functions (UDF) can be modified independently of the application source code. In this lesson, you will learn how to create functions.


Cursor is another type of object available in T-SQL that allows you to work on a single row and change the rows sequentially.


A trigger is an object that is activated when a specific event occurs. In this lesson, you will get to know the triggers types, learn how to create and use them.

T-SQL For Beginners
Aug 13 2019

Artur M

T-SQL (Transact-SQL) is a Microsoft extension to the SQL (Structured Query Language). T-SQL is central to using Microsoft SQL Server. In this course, you will learn the basics of this language in a few dozen minutes.