Back to articles list Articles Cookbook
8 minutes read

How to Learn T-SQL Querying

T-SQL is the dialect of SQL used by Microsoft SQL Server databases. Find out the best way to learn T-SQL querying with interactive online courses.

In today's data-driven world, increasing your database knowledge is always a good choice. Microsoft SQL Server is one of the most popular databases nowadays. Knowing T-SQL – the query language of SQL Server databases –is often recommended as a worthwhile skill for careers in IT, business, or research fields.

If you need to quickly learn T-SQL, I recommend's SQL Basics in MS SQL Server course. The course takes about 10 hours to complete. By the time you've worked through the 130 interactive exercises, you'll feel confident using T-SQL effectively in your work.

What Is T-SQL?

T-SQL (or Transact-SQL) is a dialect of SQL (Structured Query Language), a language used to work with databases. SQL allows you to extract and analyze data and to create and manipulate databases. It's very easy to learn, and you don't have to be an IT guru to use it effectively.

The SQL language is defined by ANSI standards, but each database vendor has adapted these standards slightly to make their own versions of the language.  Some vendors have added extra features to their version of SQL, and some have not yet implemented all the latest features defined in ANSI SQL. Some dialects use slightly different syntax for various features.

T-SQL is the SQL dialect used by Microsoft SQL Server. SQL Server has a strong following in the database marketplace. Many companies choose it because it's compatible with other Microsoft products, including data analysis tools like Power BI.

Microsoft has released various different versions of SQL Server aimed at different-sized organizations. SQL Server Express is free, and works well as a learning tool and a storage system for very small businesses. The top-of-the range Enterprise version is used by large corporations, and there are intermediate versions suitable for other business models. You can read more about the pros and cons of using MS SQL Server. You can also read more about it the history of SQL Server and the difference between ANSI SQL and T-SQL.

Why Should You Learn T-SQL?

Successful companies rely on accurate data to make informed decisions. In the old days, companies would rely on their IT department to provide the right information, but the modern trend is towards data democratization – making data available directly to those who need it. Since the majority of databases use SQL as a querying tool, it's important for everyone who needs access to data to learn the language. Whether you're planning a career in IT or you want to become an expert in your own field, it's worth learning SQL.

So why would you choose to learn T-SQL rather than standard ANSI SQL? One reason would be that you're already working for an organization that uses SQL Server. In that case, it will be more useful to learn all the additional features of T-SQL and the exact syntax used for querying your company's database.

Another reason is that since MS SQL Server is a popular product amongst Microsoft's huge client base, familiarity with T-SQL querying will definitely help you next time you're job hunting. It's a great skill to have on your CV.

What's the Best Way to Learn T-SQL Querying?

For most people, online courses offer the best learning experience. They're not expensive. You can learn at home or at work, and you can complete the work on your own schedule. Online courses use your browser to access a real database populated with test data, so you can practice your skills in a realistic setting. And the best courses offer help from an instructor or mentor.

At, we have a wide range of online SQL courses. All our courses include plenty of practical work. You can access the database through your browser, so there's no need to install any software on your own computer. The courses are interactive and include lots of true-to-life examples and exercises so you can practice your skills. If you get stuck, you can use the included hints, discuss the problem with our learning community, or contact an instructor if you need something explained more fully.

You'll first be given some reading and shown one or two examples. Here's a screenshot from one of our courses:

learn t-sql querying

Next, you'll be given some exercises so you can try out your new skills. You can type your answer into the code editor and run it. If you've typed in a valid SQL query, the results from the database will appear in the results window. You'll be told whether your answer was correct. If it wasn't, you can use a hint or ask to see the answer. The screen looks something like this:

learn t-sql querying

From Beginner to Expert in T-SQL

If you're serious about learning T-SQL querying, I recommend our SQL from A to Z in MS SQL Server learning track. This track starts at beginner level, and goes through to advanced T-SQL topics. You'll have access through your browser to an MS SQL Server database containing suitable practice data, and you'll work on the kind of problem you'd solve in a real business.

This learning track consists of 7 interactive courses. After completing its 800+ practical exercises, you'll gain all the skills and confidence you need to become a T-SQL expert. It would be hard to find more comprehensive coverage of T-SQL in an online course.

The 7 courses that make up this track are:

  1. SQL Basics in MS SQL Server

This is the best starting point to learn T-SQL querying. It teaches you the concepts of relational databases and the basic syntax of T-SQL queries. You'll learn how to extract data from the database and how to join two or more tables in your queries. You'll also find out how to aggregate data and do simple mathematical computations.

  1. Common Functions in MS SQL Server

T-SQL includes lots of built-in functions. They're designed to allow you to manipulate and format text, do arithmetic with dates and times, deal with empty fields (aka NULLs), and much more. If you're a software developer, you definitely need to be able to use these functions. You'll also need them if you want to produce nicely formatted data suitable for reports and presentations.

  1. How to Insert, Update, or Delete Data in MS SQL Server

In this course, you'll learn to change the data in the database. Since accurate data is essential to any company, you need a way of maintaining and cleaning up the contents of your database.  These skills are essential for database administrators, but they’re also useful for anyone who 'owns' a set of data.

  1. Creating Basic SQL Reports in SQL Server

This course gives you experience in producing the type of reports that you'll need in most business and research organizations. You'll have access to test data from a fictional store and you'll learn to use T-SQL to answer questions like:

  • Which product categories are most popular?
  • What is the average order value?
  • How many orders does the typical customer place?

You'll also learn techniques for building typical business reports and for avoiding common mistakes.

  1. Window Functions in MS SQL Server

Also known as OVER() functions or analytical functions, these are a relatively new feature in SQL. They're used for complex analytical queries; they allow you to easily extract rankings, running totals, moving averages and year-on-year comparisons. Essentially, they make it possible to show aggregates alongside data taken from individual rows.

This course has more than 200 interactive exercises, so you can consolidate complex concepts with plenty of practice.

  1. Recursive Queries in MS SQL Server

This course teaches the use of the WITH clause in T-SQL – another relatively new feature. The WITH clause allows you to conveniently break large, complex queries into a series of smaller named subqueries. This not only makes the query easier to write, it makes it much more readable.

The WITH clause also allows you to recursively process hierarchical data in the form of trees and graphs. The 100+ real-life examples will give you plenty of practice.

  1. GROUP BY Extensions in MS SQL Server

The GROUP BY clause was originally restrictive; you could only show aggregates at the lowest level of grouping. For example, if you grouped your customers by area within a country, the standard GROUP BY clause would let you show totals for each area, but not for each country as a whole.

The GROUP BY extensions –  ROLLUP, CUBE and GROUPING SET – were introduced to overcome this. These features are essential for most business and research applications, and they are well worth learning. This course has 63 interactive exercises.

Learn How to Query T-SQL Today!

T-SQL querying is a valuable skill in today's data-driven world. It's a great asset in many different careers, and it looks good on your CV. So why not take the first step to becoming a T-SQL expert by signing up with today?