What you'll learn:
- Combine and compare datasets using UNION, UNION ALL, INTERSECT and EXCEPT
- Understand the difference between and use of CASE, ISNULL and COALESCE
- MERGE two tables together, taking different actions if similar rows exist in both tables than if they don't.
- Create parameterised PROCEDUREs, allowing you to store multiple commands together for later use.
- EXECUTE those procedures, and add OUTPUT parameters to obtain RESULTs.
- Introduce error checking with TRY, CATCH, THROW and more!
This course is the foundation for the Microsoft Certificate 70-461: "Querying Microsoft SQL Server 2012/2014". Please note - this certificate is no longer being offered by Microsoft. However, the exam requirements allow you to have a good understanding of T-SQL.
Welcome to Session 4 of this T-SQLcourse. In this course:
We will further encapsulate our routines by creating procedures, allowing us to EXECUTE parameterised commands with just one statement.
We'll add some error handling with TRY, CATCH and THROW.
We'll also combine datasets together and compare them, by looking at
UNION and UNION ALL, which allows us to combine sets,
INTERSECT and EXCEPT, which compares datasets, and
the mighty MERGE statement, which allows for conditional INSERT, UPDATE and DELETEs.
We'll also create conditional logic:
CASE, the equivalent of the IF statement in Excel,
ISNULL and Coalesce, which replaces NULLs,
No prior knowledge other than what we covered in Sessions 1 to 3 is required. However, prior experience with Excel or Access would be beneficial.
There are regular quizzes to help you remember the information.
Once finished, you will know what how to write procedures, add error handling, and combine datasets together and compare them, and we'll have expanded on our current knowledge of T-SQL.