VIDEOS BY CATEGORY
ADVANCED SQL (PROGRAMMING) VIDEOS
- SQL Programming Part 1 - Stored Procedure Basics
- SQL Programming Part 2 - Stored Procedure Parameters
- SQL Programming Part 3 - Variables in SQL
- SQL Programming Part 4 - Output Parameters and Return Values
- SQL Programming Part 5 - IF Statements in SQL
- SQL Programming Part 6 - WHILE Loops
- SQL Programming Part 7 - User Defined Functions
- SQL Programming Part 8 - Temporary Tables
- SQL Programming Part 9 - Table variables
- SQL Programming Part 10 - Table-Valued Functions
- SQL Programming Part 12 - Cursors
- SQL Programming Part 11 - Common Table Expressions (CTEs)
- SQL Programming Part 13 - Dynamic SQL
- SQL Programming Part 14 - Transactions
- SQL Programming Part 15 - DML Triggers
- SQL Programming Part 16 - DDL Triggers
- SQL Programming Part 17 - The Pivot Operator
- SQL Programming Part 18 - Dynamic Pivot Tables
VIDEOS BY AUTHOR
Training videos for learning ADVANCED SQL (PROGRAMMING)
We have 18 Advanced SQL (programming) videos listed below. You might also like to consider booking a place on one of our online or classroom SQL courses, where you will meet the owls behind the videos!
Posted by Andrew Gould on 19 November 2012
If you ever find yourself writing the same SQL query over and over again, a Stored Procedure could be just the time-saving tool you're looking for. This video introduces you to the concept of stored procedures and will show you how to create, execute and modify these useful elements of SQL Server.
Posted by Andrew Gould on 20 November 2012
Stored Procedures are extremely useful tools in SQL Server, and they become even more powerful when you use parameters to pass information to them. This video teaches you how to define a list of parameters for a stored procedure and how to call a parameterised procedure and pass information to it. You'll also learn how to create optional parameters with default values, how to handle NULLs passed to a procedure and, finally, how to use your procedure in other applications such as Reporting Services.
Posted by Andrew Gould on 21 November 2012
Using variables allows you to give your SQL procedures a memory. You can store a value in a variable and then retrieve and reuse that value at any point later in the same procedure. This video teaches you how to declare variables, assign values to them and make use of those values in a query. You'll also see how to store the result of a SELECT statement in a variable, as well as how to accumulate the value of a variable. You'll see a couple of methods of displaying the value stored in a variable and we'll end with a quick overview of the global variables in SQL Server.
Posted by Andrew Gould on 28 November 2012
Output parameters and return values are two methods in SQL for getting information out of a stored procedure. This video teaches you how to use both methods, including how to define output parameters and set their values within a procedure, how to add a return statement to a stored procedure, and how to capture the output of a procedure when you execute it.
Posted by Andrew Gould on 03 December 2012
IF statements in SQL allow you to check if a condition has been met and, if so, to perform a sequence of actions. This video teaches you everything from the basic syntax of IF statements, including how to use the ELSE clause and perform multiple actions using a BEGIN and END block. We'll also teach you how to nest your IF statements, including a few useful tips on how to make your nested IFs readable!
Posted by Andrew Gould on 05 December 2012
In SQL Server there is only one type of loop: a WHILE loop. This video teaches you how to use them, from the basic syntax of the WHILE statement, through how to use a SELECT statement within a loop. We'll also cover how to use the BREAK command to exit from a loop, what to do when you inevitably find yourself in an endless loop and, finally, a quick introduction to using loops with cursors.
Posted by Andrew Gould on 31 January 2013
If you have a calculation that you frequently use in SQL queries you're probably bored of writing out the same code time after time. Why not try creating a user-defined function to save you the hassle! This video teaches you how to define your own custom functions, including how to use input parameters, how to alter a function after you've created it, and even how to use fancy programming techniques such as variables and IF statements to help structure complex sequences of calculations.
Posted by Andrew Gould on 06 February 2013
There are many techniques in SQL Server for working with temporary data: this video deals with Temporary Tables (you know, the ones that begin with a #). You'll learn how to create and remove temporary tables, where they live during their short lifespans, how to extend their scope by using global temp tables, and how you can use temporary tables within stored procedures.
Posted by Andrew Gould on 19 February 2013
In SQL Server, Table Variables provide an alternative to Temporary Tables when working with temporary sets of data. This video teaches you how to declare table variables and insert records into them. You'll learn about the differences between table variables and temporary tables, including why one technique isn't always better than the other. Finally, you'll also hear about one of the common rumours surrounding table variables and why it's actually just a myth!
Posted by Andrew Gould on 19 February 2013
Table-Valued Functions in SQL Server represent yet another method for working with a temporary set of data. This video teaches you how to create both Inline Table-Valued Functions and Multi-Statement Table-Valued Functions. You'll learn how to define functions, including how to add parameters to them, and how to work with Table Variables within a function's definition.
Posted by Andrew Gould on 26 March 2013
Most of the operations you perform in SQL work against an entire set of records in one go. Cursors, on the other hand, allow you to process a set of records one row at a time. In this video you'll learn how to declare a cursor and how to make it step through a set of records. Along the way you'll learn about the various FETCH statements and additional cursor options. From a practical point of view you'll see how to execute a stored procedure against each record in a table and how to use a cursor to update data in a table by creating a running total column.
Posted by Andrew Gould on 21 March 2013
A Common Table Expression in SQL is a technique for creating a temporary recordset that you immediately use in another statement - they're often a neat alternative to using Temporary Tables. In this video we'll teach you how to create and consume a CTE, show you a couple of practical uses for them and hopefully convince you that they're worth using!
Posted by Andrew Gould on 10 May 2013
Dynamic SQL lets you build a complete SQL statement out of individual strings of text and execute it as though it was an SQL statement. It allows you to create immensely flexible queries in which any part of a statement can be parameterised, but it can also leave you vulnerable to the dreaded SQL injection attack! This video teaches you how to build dynamic SQL statements, how to use stored procedures to parameterise the process, and the potential dangers of using dynamic SQL in a live system.
Posted by Andrew Gould on 20 May 2013
Transactions take place whenever you modify data in your database. Normally this process is handled by SQL Server but this video teaches you how to control your transactions. You'll learn how to specify when your transactions begin, when the changes are committed and even how to undo the changes using the Rollback statement. We'll also cover how to use transactions with error handling code, how to create savepoints within a transaction, and how to use nested transactions in stored procedures.
Posted by Andrew Gould on 22 November 2013
Triggers are special stored procedures that you can attach to various events within a database. This video covers DML, or Data Manipulation Language triggers, which you can use to handle events associated with inserting, updating and deleting data in tables and views.
Posted by Andrew Gould on 27 November 2013
Triggers are special stored procedures that you can attach to various events within a database. This video covers DDL, or Data Definition Language triggers, which you can use to handle events associated with changing the objects in a datatbase. This video concentrates on creating triggers to handle the CREATE, ALTER and DROP events and will show you how to scope a trigger to a single database or to an entire server. You'll also see how to disable and enable triggers, as well as how to change the order in which your triggers fire.
Posted by Andrew Gould on 13 October 2014
The Pivot Operator in Microsoft SQL Server allows you to group data by columns, as well as by rows, to create simple static pivot tables. This video teaches you how to use the pivot operator including how to apply aggregate functions and, importantly, a quick method for listing out the column headings of your pivot table using the QuoteName function.
Posted by Andrew Gould on 13 October 2014
The most annoying part of creating a pivot table in Microsoft SQL Server is listing out the column headings for the table. This video explains how to use dynamic SQL so you no longer have to repeat this laborious task. The video includes a quick recap of basic pivot tables, how to use the QuoteName function to generate a list of column headings, how to build an SQL statement and store it as a string of text and, finally, how to execute the dynamic SQL string.