Courses

TSQL for Beginners (Redgate University)

TSQL for Beginners (Redgate University)

on July 20, 2020

This free course introduces you to the Transact SQL language implemented in SQL Server and takes you from newbie to a master of SELECT statements.

The course contains 8 classes with more than 7.5 hours of video content.

Continue reading

The Idempotent TSQL SQLChallenge (28 minutes)

The Idempotent TSQL SQLChallenge (28 minutes)

on June 29, 2019

When writing TSQL, it’s often useful to make your TSQL idempotent – a fancy word, which in the case of databases really just means: you can run the command again and again and it will make sure that you have the intended effect, without causing problems by being run more than once.

In this challenge, you’ll get multiple TSQL statements and be challenged to make them idempotent.

Continue reading

Who Made That Schema Change? An Event Notification SQLChallenge (27 minutes)

Who Made That Schema Change? An Event Notification SQLChallenge (27 minutes)

on May 7, 2019

In this challenge, you get to take a crack at creating an Event Notification to track schema changes.

We covered DDL Triggers in a past SQL Challenge. DDL Triggers are tightly coupled with the commands that call them: like other triggers, the code in the trigger becomes part of the transaction of the code that causes the trigger to fire. Event Notifications are different: even if the event notification fails, the command that causes it to fire may go on none-the-wiser. That’s often desirable (but not always).

Continue reading

Who Made That Schema Change? A DDL Trigger SQLChallenge (28 minutes)

Who Made That Schema Change? A DDL Trigger SQLChallenge (28 minutes)

on April 9, 2019

In this challenge, you get to take a crack at writing a DDL Trigger to track schema changes.

DDL Triggers are tightly coupled with the commands that call them: like other triggers, the code in the trigger becomes part of the transaction of the code that causes the trigger to fire. For this reason, you are challenged not only to create a DDL trigger, but also to test the trigger by also causing the trigger to fire when run in the context of a specific user. Don’t worry, there’s code for it all in the challenge.

Continue reading

A Query Writing SQLChallenge: The Most Unique Names (23 minutes)

A Query Writing SQLChallenge: The Most Unique Names (23 minutes)

on March 12, 2019

Flex your T-SQL skills: you’re challenged to write four different (but related) queries in this query writing challenge.

The queries that you are challenged to write are each related to the prior query. The final challenge is the most complex. You can start at the fourth challenge and just do that one, or work through the challenge, copy the prior query, and build upon that – choose your own adventure.

Continue reading

A Dynamic SQLChallenge (32 minutes)

A Dynamic SQLChallenge (32 minutes)

on February 12, 2019

In this challenge, you are tasked with editing a stored procedure to gather data from multiple databases. What’s the most efficient way to do it? Try your hand at the challenge, then check out three different suggested solutions.

Continue reading

Tune the Peak Years Procedure - SQLChallenge (52 minutes)

Tune the Peak Years Procedure - SQLChallenge (52 minutes)

on January 30, 2019

Ready to tune some TSQL? In this challenge, you’re given a database to restore. You’ll create two indexes and a constraint in the database– and you aren’t allowed to change those.

Your mission, if you choose to accept it, is to tune the TSQL in a stored procedure so it can make the best use of the given indexes – and still returns the same results. You’re given two sample calls to the procedure, and your goal is to make it as fast as possible.

Continue reading