Querying Microsoft SQL Server with Transact-SQL


arrow-left
Back To All Courses

278

Lessons

All

Skill Level

29:47h

course Duration

English

Audio

Eng & Esp

Subtitles

Share This Class:

Overview

This course is the foundation for learning T-SQL. It follows the Microsoft Certificate 70-461: “Querying Microsoft SQL Server 2012” and 70-761 “Querying Data with Transact-SQL”. While these certificates are no longer available, its curriculum allows you to gain a master of T-SQL.

To start with, you will be installing for free the software that we will be using throughout this course (SQL Server and SQL Server Management Studio – SSMS).

This course is divided into 7 sessions, each of which can be completed in a morning or afternoon. 

No prior knowledge is required.

There are regular quizzes to help you remember the information.

Once finished, you will know what how to manipulate numbers, strings and dates, and create database and tables, create tables, insert data and create analyses, and have an appreciation of how they can all be used in T-SQL

Completing this course will help you:

  • Create tables in a database and ALTER columns in the table.
  • Know what data type to use in various situations, and use functions to manipulate date, number and string data values.
  • Retrieve data using SELECT, FROM, WHERE, GROUP BY, HAVING and ORDER BY.
  • JOIN two or more tables together, finding missing data.
  • INSERT new data, UPDATE and DELETE existing data, and export data INTO a new table.
  • Create constraints, views and triggers
  • Use UNION, CASE, MERGE, procedures and error checking
  • Apply ranking and analytic functions, grouping, geography and geometry database
  • Create subqueries and CTEs, PIVOTs, UDFs, APPLYs, synonyms.
  • Learn about transactions, optimise queries and row-based v set-based operations
  • Manipulate XMLs and JSONs.

Who is the course for?

This SQL course is meant for you, if you have not used SQL Server much (or at all), and want to learn T-SQL.

This course is also for you if you want a refresher on SQL. However, no prior SQL Server knowledge is required.

Learning Path

Session 1 – Install SQL Server, creating tables, and learn about Number, String and Date Data Types and Functions

The basics presented are: how to install SQL Server, and how to create and drop tables.

We then try to create a more advanced table, but find that we need to know more about data types – so we go into some detail about data types and data functions, the foundation of T-SQL.

Session 2 – The SELECT statement

We’ll create tables which use these, and then INSERT some data into them. Then we’ll write queries which will retrieve and summary this data, using SELECT, FROM, WHERE, GROUP BY, HAVING and ORDER BY.

We’ll then JOIN these tables together to find where we are missing data and where we have inconsistent data. We’ll then UPDATE and DELETE data from the tables. 

Session 3 – Constraints, Views and Triggers

We’ll now use that data to create views, which enable us to store these SELECT queries for future use, and triggers, which allow for code to be automatically run when INSERTing, DELETEing or UPDATEing data.

We’ll look at the database that we developed in session 2, and see what is wrong with it. We’ll add some constraints, such as UNIQUE, CHECK, PRIMARY KEY and FOREIGN KEY constraints, to stop erroneous data from being added some data.

Session 4 – Combining datasets, procedures, and error handling
We will further encapsulate our routines by creating procedures, allowing us to EXECUTE parameterised commands with just one statement, and we’ll add some error handling with TRY, CATCH and THROW.

We’ll also combine datasets together, by looking at UNION and UNION ALL, INTERSECT and EXCEPT, CASE, ISNULL and Coalesce, and the mighty MERGE statement. By doing this, we will complete objectives 11, 12, 13 and parts of 6 and 18 from the 70-461 exam.
Session 5 – Aggregate queries, ranking and analytic functions, grouping sets, and spatial aggregates
We’ll will now be creating aggregate queries, working through objective 9 of the exam 70-461. We’ll be reviewing the ranking functions ROW_NUMBER, RANK, DENSE_RANK and NTILE. We’ll look at the 8 analytic functions news to SQL Server 2012, such as LAG, LEAD, FIRST_VALUE and LAST_VALUE.

We’ll look at alternative ways of grouping and adding totals, using ROLLUP, CUBE, GROUPING SETS and GROUPING_ID. If you want to take the 70-461 exam, we’ll also look at the geometry and geography data types, plotting locations on a grid, together with functions and aggregates.
Session 6 – Sub-queries, WITH statement, PIVOT, CTE statement, Functions, Synonyms, GUIDs, Sequences, XML, JSON and Temporal Tables
We’ll will now be creating sub-queries, working through objectives 7b-e of the exam 70-461. We’ll be created correlated subqueries, where the results of the subquery depend on the main query. We’ll be looking at Common Table Expressions using the WITH statement, and we’ll be using what we have learned to solve a common business problem.

We’ll be looking at functions (objective 14), including the three different types of User Defined Functions (UDF): scalar functions, inline table functions, and multi-statement table functions. We’ll then complete objective 6 by looking at synonyms and dynamic SQL, and objective 8 by looking at the use of GUIDs. We’ll also look at sequences.

We’ll have a look at XML. Finally, for SQL Server 2016 and later (exam 70-761), we’ll examine JSON and Temporal Tables.
Session 7 – Transactions, indexes, Optimise queries, DMVs and DMFs, and row-based versus set-based operations

In this session we’ll be looking at transactions, seeing how to explicitly start and end them, and finding out how they can block other users in the database. Then we’ll see about how to indexes and their role in optimising queries. 

We’ll also see how we can use Dynamic Management Views to see how we can improve our use of indexes. We’ll then look at how to write a cursor, and when to use this row-based operation, and the impact of using scalar UDFs

What people are saying

“The instructor explain the things in great details. Very easy to follow.”
Linda
“Excellent course, valuable lessons, very well taught at a great pace.”
Shane
“Must get tutorial. Love it”
Hayford
“Perfect step by step guide to learning. Best I’ve seen.”
Charles
Previous
Next

Are You Ready To Start?

More Courses

You might also be interested in these courses

Database Fundamentals in 8 hours

Learning Database Fundamentals with Microsoft SQL Server

Microsoft SQL Server Reporting Services

Learn to create reports in SSRS