Read our blogs, tips and tutorials
Try our exercises or test your skills
Watch our tutorial videos or shorts
Take a self-paced course
Read our recent newsletters
License our courseware
Book expert consultancy
Buy our publications
Get help in using our site
546 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owl trainers only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
You are welcome to try any of the 203 SQL exercises listed below, but please do not distribute them in any form without asking for our written permission first.
Software: | SQL |
Topic: | Using SQL Server |
Level: | Relatively easy |
Exercise: | Use a script to create the Wise Owl Music database which you can then use to complete a range of other exercises. |
Software: | SQL |
Topic: | Simple Queries |
Level: | Relatively easy |
Exercise: | Create a query to list out all of the events in the database, with the most recent first. |
Software: | SQL |
Topic: | Simple Queries |
Level: | Relatively easy |
Exercise: | Create a query using TOP N to show the last 3 categories in a table. |
Software: | SQL |
Topic: | Simple Queries |
Level: | Relatively easy |
Exercise: | Write a basic SQL Select statement to return an ordered list of musical artists. |
Software: | SQL |
Topic: | Simple Queries |
Level: | Average difficulty |
Exercise: | Create a query to list the first 5 events in chronological order. |
Software: | SQL |
Topic: | Simple Queries |
Level: | Average difficulty |
Exercise: | Select and sort a list of albums, showing the top items for different columns. |
Software: | SQL |
Topic: | Simple Queries |
Level: | Harder than average |
Exercise: | Run two SELECT queries to show the first and last events. |
Software: | SQL |
Topic: | Simple Queries |
Level: | Harder than average |
Exercise: | Write SQL queries to select and sort a list of venues, showing the top items for different columns. |
Software: | SQL |
Topic: | Setting criteria using WHERE |
Level: | Relatively easy |
Exercise: | Add criteria to a SQL query to show singles released on different dates. |
Software: | SQL |
Topic: | Setting criteria using WHERE |
Level: | Relatively easy |
Exercise: | Create a query to list all of the love and relationships events. |
Software: | SQL |
Topic: | Setting criteria using WHERE |
Level: | Relatively easy |
Exercise: | Use the WHERE clause in a SQL query to return lists of albums filtered by different criteria. |
Software: | SQL |
Topic: | Setting criteria using WHERE |
Level: | Relatively easy |
Exercise: | Use the WHERE clause in a SQL query to test conditions on text fields for a list of music albums. |
Software: | SQL |
Topic: | Setting criteria using WHERE |
Level: | Average difficulty |
Exercise: | Us a WHERE clause to show events which contain two given text strings. |
Software: | SQL |
Topic: | Setting criteria using WHERE |
Level: | Average difficulty |
Exercise: | Use a WHERE clause to show all of the events between two given dates. |
Software: | SQL |
Topic: | Setting criteria using WHERE |
Level: | Average difficulty |
Exercise: | Use the LIKE operator and wildcard characters in the WHERE clause of a SQL query to return a list of live music venues. |
Software: | SQL |
Topic: | Setting criteria using WHERE |
Level: | Average difficulty |
Exercise: | Use the WHERE clause in a SQL query to apply criteria to various date fields in a table of live music venues. |
Software: | SQL |
Topic: | Setting criteria using WHERE |
Level: | Average difficulty |
Exercise: | Use the WHERE clause in SQL queries to combine criteria and filter a list of albums. |
Software: | SQL |
Topic: | Setting criteria using WHERE |
Level: | Average difficulty |
Exercise: | Write SQL queries using the WHERE clause to test for the existence of NULL in a list of music albums. |
Software: | SQL |
Topic: | Setting criteria using WHERE |
Level: | Harder than average |
Exercise: | 3 challenging queries combining criteria to find possible data anomalies. |
Software: | SQL |
Topic: | Setting criteria using WHERE |
Level: | Harder than average |
Exercise: | Use wildcards, AND, IN and OR to get a list of events to do with water. |
Software: | SQL |
Topic: | Calculations |
Level: | Relatively easy |
Exercise: | Add basic expressions to an SQL query to calculate new values from existing columns in a table. |
Software: | SQL |
Topic: | Calculations |
Level: | Relatively easy |
Exercise: | Create calculated columns in SQL queries which concatenate multiple values to form longer strings. |
Software: | SQL |
Topic: | Calculations |
Level: | Relatively easy |
Exercise: | List for each event the number of characters in its name. |
Software: | SQL |
Topic: | Calculations |
Level: | Relatively easy |
Exercise: | Use the CAST and CONVERT functions in SQL queries to control the data types of calculated columns. |
Software: | SQL |
Topic: | Calculations |
Level: | Relatively easy |
Exercise: | Use the IIF function and CASE expression to create calculated columns in a SQL query based on a list of music albums. |
Software: | SQL |
Topic: | Calculations |
Level: | Relatively easy |
Exercise: | Use the ISNULL function in SQL queries to convert nulls into meaningful values. |
Software: | SQL |
Topic: | Calculations |
Level: | Average difficulty |
Exercise: | Add calculated columns to a SQL query to work out the average length of songs in a list of albums. |
Software: | SQL |
Topic: | Calculations |
Level: | Average difficulty |
Exercise: | Cast numbers as text to allow you to concatenate them together with strings. |
Software: | SQL |
Topic: | Calculations |
Level: | Average difficulty |
Exercise: | Create calculated columns in SQL Server using the ISNULL function to handle nulls in the data. |
Software: | SQL |
Topic: | Calculations |
Level: | Average difficulty |
Exercise: | Use CASE expressions in SQL queries to categorise a list of venues based on different criteria. |
Software: | SQL |
Topic: | Calculations |
Level: | Average difficulty |
Exercise: | Use IsNull, Coalesce and/or CASE WHEN to replace nulls with values. |
Software: | SQL |
Topic: | Calculations |
Level: | Average difficulty |
Exercise: | Use text functions in SQL queries to clean up messy text data. |
Software: | SQL |
Topic: | Calculations |
Level: | Average difficulty |
Exercise: | Write a CASE WHEN expression to assign countries to different groups. |
Software: | SQL |
Topic: | Calculations |
Level: | Harder than average |
Exercise: | Divide events according to whether their first/last letters are the same or vowels. |
Software: | SQL |
Topic: | Calculations |
Level: | Harder than average |
Exercise: | Use a variety of text functions in SQL queries to manipulate names and addresses of a list of venues. |
Software: | SQL |
Topic: | Calculations |
Level: | Harder than average |
Exercise: | Use CASE expressions in SQL queries to categorise a list of concerts by ticket sales and cancellations. |
Software: | SQL |
Topic: | Calculations |
Level: | Harder than average |
Exercise: | Use the % modulus operator and a lot of ingenuity to show how big each country is relative to Wales. |
Software: | SQL |
Topic: | Calculations |
Level: | Harder than average |
Exercise: | Use the CHARINDEX function multiple times to show the number of characters between two words in a text string. |
Software: | SQL |
Topic: | Calculations using dates |
Level: | Relatively easy |
Exercise: | Combine the YEAR, CONVERT and FORMAT functions to show events in your year of birth. |
Software: | SQL |
Topic: | Calculations using dates |
Level: | Relatively easy |
Exercise: | Use SQL date functions to format the release dates of music albums in SQL queries. |
Software: | SQL |
Topic: | Calculations using dates |
Level: | Average difficulty |
Exercise: | Use date functions in SQL queries to calculate the length of concert tours. |
Software: | SQL |
Topic: | Calculations using dates |
Level: | Average difficulty |
Exercise: | Use the DATEDIFF and the ABS functions to list the events in order of closeness to when you were born. |
Software: | SQL |
Topic: | Calculations using dates |
Level: | Average difficulty |
Exercise: | Use the DATENAME and DATEPART functions to show events taking place on Friday 13th of any month/year. |
Software: | SQL |
Topic: | Calculations using dates |
Level: | Harder than average |
Exercise: | Display full dates, including the correct suffix (1st, 2nd, 3rd, etc). |
Software: | SQL |
Topic: | Calculations using dates |
Level: | Harder than average |
Exercise: | Use date functions in SQL Server to calculate the lifespan of venues. |
Software: | SQL |
Topic: | Basic joins |
Level: | Relatively easy |
Exercise: | Create a query containing a join to list out those films whose source is NA. |
Software: | SQL |
Topic: | Basic joins |
Level: | Relatively easy |
Exercise: | Create a query using the designer, joining 2 tables, then tidy it up and comment its SQL. |
Software: | SQL |
Topic: | Basic joins |
Level: | Relatively easy |
Exercise: | Use an inner join to link two tables together in a query. |
Software: | SQL |
Topic: | Basic joins |
Level: | Relatively easy |
Exercise: | Use the Query Designer in SQL Server Management Studio to join multiple tables in a database of music. |
Software: | SQL |
Topic: | Basic joins |
Level: | Average difficulty |
Exercise: | Create an inner join in a query, then change it to an outer join to show categories having no events. |
Software: | SQL |
Topic: | Basic joins |
Level: | Average difficulty |
Exercise: | Join two tables together in SQL, using alias table names. |
Software: | SQL |
Topic: | Basic joins |
Level: | Average difficulty |
Exercise: | Link the continent, country and event tables with inner joins, and then filter by fields from 2 tables. |
Software: | SQL |
Topic: | Basic joins |
Level: | Average difficulty |
Exercise: | Use basic inner joins to list music albums and their genres before applying filters to the list. |
Software: | SQL |
Topic: | Basic joins |
Level: | Average difficulty |
Exercise: | Use inner joins to link four tables to show Dr Who enemies by author. |
Software: | SQL |
Topic: | Basic joins |
Level: | Harder than average |
Exercise: | Add joins to SQL queries to return values from multiple tables in a database of music. |
Software: | SQL |
Topic: | Basic joins |
Level: | Harder than average |
Exercise: | Use an outer join and criterion to list out the countries which have no corresponding events. |
Software: | SQL |
Topic: | Basic joins |
Level: | Harder than average |
Exercise: | Use inner joins to link lots of tables together, with a WHERE clause. |
Software: | SQL |
Topic: | More exotic joins |
Level: | Relatively easy |
Exercise: | Use outer joins in SQL queries to return every row from a table of concert tours. |
Software: | SQL |
Topic: | More exotic joins |
Level: | Average difficulty |
Exercise: | Use outer joins in SQL queries to return a list of music artists who don't have any associated concert tours. |
Software: | SQL |
Topic: | More exotic joins |
Level: | Average difficulty |
Exercise: | Write an SQL outer join to show unmatched records in another table. |
Software: | SQL |
Topic: | More exotic joins |
Level: | Harder than average |
Exercise: | Create 2 self-joins between a table of families and itself, to show families, their parents and their grandparents. |
Software: | SQL |
Topic: | More exotic joins |
Level: | Harder than average |
Exercise: | Use inner and outer joins in SQL queries to return lists of albums, artists and concert tours. |
Software: | SQL |
Topic: | Aggregation and grouping |
Level: | Relatively easy |
Exercise: | Use COUNT, MAX and MIN to show statistics about the rows in the events table. |
Software: | SQL |
Topic: | Aggregation and grouping |
Level: | Relatively easy |
Exercise: | Use GROUP BY and COUNT to report on the number of events for each category. |
Software: | SQL |
Topic: | Aggregation and grouping |
Level: | Relatively easy |
Exercise: | Use grouping to show how many episodes each Doctor Who author wrote. |
Software: | SQL |
Topic: | Aggregation and grouping |
Level: | Relatively easy |
Exercise: | Use SQL queries to group a list of music artists and create statistics related to their albums. |
Software: | SQL |
Topic: | Aggregation and grouping |
Level: | Relatively easy |
Exercise: | Use the GROUP BY clause in SQL queries to calculate aggregated values for a list of music artists. |
Software: | SQL |
Topic: | Aggregation and grouping |
Level: | Average difficulty |
Exercise: | Group by 2 fields and use HAVING clause to show popular combinations. |
Software: | SQL |
Topic: | Aggregation and grouping |
Level: | Average difficulty |
Exercise: | Use SELECT, FROM, WHERE, GROUP BY, HAVING and ORDER BY to list non-European busy countries. |
Software: | SQL |
Topic: | Aggregation and grouping |
Level: | Average difficulty |
Exercise: | Write SQL queries to group concerts by multiple different geographic columns and create basic aggregations. |
Software: | SQL |
Topic: | Aggregation and grouping |
Level: | Harder than average |
Exercise: | Combine CAST, AVG, COUNT, LEN, UPPER and LEFT to show the average length of event names by category initial. |
Software: | SQL |
Topic: | Aggregation and grouping |
Level: | Harder than average |
Exercise: | Use a complex CASE statement to show the number of events for each century, including the CUBE function. |
Software: | SQL |
Topic: | Aggregation and grouping |
Level: | Harder than average |
Exercise: | Use lots of grouping and criteria to list out year/doctor episode counts. |
Software: | SQL |
Topic: | Aggregation and grouping |
Level: | Harder than average |
Exercise: | Use SQL queries to group a list of albums by multiple columns and create subtotals for the groups. |
Software: | SQL |
Topic: | Subqueries |
Level: | Relatively easy |
Exercise: | Use a subquery to show events which happened since the last one for a particular country occurred. |
Software: | SQL |
Topic: | Subqueries |
Level: | Relatively easy |
Exercise: | Use subqueries in SQL to use aggregate functions as criteria for other queries. |
Software: | SQL |
Topic: | Subqueries |
Level: | Relatively easy |
Exercise: | Use subqueries to filter with aggregates. |
Software: | SQL |
Topic: | Subqueries |
Level: | Average difficulty |
Exercise: | Create a correlated subquery to list out all countries having more than 8 events. |
Software: | SQL |
Topic: | Subqueries |
Level: | Average difficulty |
Exercise: | Use subqueries in SQL to return a list of longer than average music albums. |
Software: | SQL |
Topic: | Subqueries |
Level: | Average difficulty |
Exercise: | Using sub queries filter the select statement. |
Software: | SQL |
Topic: | Subqueries |
Level: | Harder than average |
Exercise: | Use nested subqueries in SQL Server to return different sets of results in a database of music. |
Software: | SQL |
Topic: | Subqueries |
Level: | Harder than average |
Exercise: | Use two subqueries to list all events in neither the last 30 countries or the last 15 categories. |
Software: | SQL |
Topic: | Stored procedures |
Level: | Relatively easy |
Exercise: | Create a basic SQL stored procedure to return a list of number 1 music albums. |
Software: | SQL |
Topic: | Stored procedures |
Level: | Relatively easy |
Exercise: | Create a stored procedure to list Dr Who episodes featuring Matt Smith. |
Software: | SQL |
Topic: | Stored procedures |
Level: | Relatively easy |
Exercise: | Filter the select statement, only show events occuring in August. |
Software: | SQL |
Topic: | Stored procedures |
Level: | Relatively easy |
Exercise: | Write a basic procedure to list countries in Asia, then make small changes to it. |
Software: | SQL |
Topic: | Stored procedures |
Level: | Average difficulty |
Exercise: | Create a SQL stored procedure to return a list of rock and roll music albums. |
Software: | SQL |
Topic: | Stored procedures |
Level: | Average difficulty |
Exercise: | Create a stored procedure to list Dr Who episodes written by Steven Moffat. |
Software: | SQL |
Topic: | Stored procedures |
Level: | Harder than average |
Exercise: | Create a SQL stored procedure to return a list of concert tours and shows. |
Software: | SQL |
Topic: | Stored procedures |
Level: | Harder than average |
Exercise: | Create a stored procedure to list Dr Who episodes by frequency in two ways. |
Software: | SQL |
Topic: | Parameters and return values |
Level: | Relatively easy |
Exercise: | Add parameters to a SQL stored procedure which returns a list of music albums. |
Software: | SQL |
Topic: | Parameters and return values |
Level: | Relatively easy |
Exercise: | Get a stored procedure to list the Dr Who episodes for a given enemy. |
Software: | SQL |
Topic: | Parameters and return values |
Level: | Relatively easy |
Exercise: | Use return values in SQL Server to pass values between stored procedures and return details of music albums. |
Software: | SQL |
Topic: | Parameters and return values |
Level: | Average difficulty |
Exercise: | Create a procedure to list out the companions for a given doctor. |
Software: | SQL |
Topic: | Parameters and return values |
Level: | Average difficulty |
Exercise: | Create a stored procedure in SQL Server using parameters to filter a list of venues. |
Software: | SQL |
Topic: | Parameters and return values |
Level: | Average difficulty |
Exercise: | Create a stored procedure to list Dr Who episodes for a series number, using a default parameter value. |
Software: | SQL |
Topic: | Parameters and return values |
Level: | Average difficulty |
Exercise: | Create a stored procedure with NULLs as the default values. |
Software: | SQL |
Topic: | Parameters and return values |
Level: | Average difficulty |
Exercise: | Create stored procedures with default values for the parameters. |
Software: | SQL |
Topic: | Parameters and return values |
Level: | Average difficulty |
Exercise: | Filter in a stored procedure using a parameter. |
Software: | SQL |
Topic: | Parameters and return values |
Level: | Average difficulty |
Exercise: | Use an output parameter to return a list variable of the most eventful continents. |
Software: | SQL |
Topic: | Parameters and return values |
Level: | Average difficulty |
Exercise: | Use optional parameters in SQL Server stored procedures to return a list of concerts. |
Software: | SQL |
Topic: | Parameters and return values |
Level: | Average difficulty |
Exercise: | Use return values in SQL Server to capture the result of a stored procedure. |
Software: | SQL |
Topic: | Parameters and return values |
Level: | Average difficulty |
Exercise: | Use return values to bring back an INT return value from a stored procedure. |
Software: | SQL |
Topic: | Parameters and return values |
Level: | Harder than average |
Exercise: | Count rows and pass the information out of a procedure using output parameters. |
Software: | SQL |
Topic: | Parameters and return values |
Level: | Harder than average |
Exercise: | Create a SQL stored procedure with multiple optional parameters. |
Software: | SQL |
Topic: | Parameters and return values |
Level: | Harder than average |
Exercise: | Return a continent name from one procedure, and pass the output value into another. |
Software: | SQL |
Topic: | Parameters and return values |
Level: | Harder than average |
Exercise: | Return from a stored proecure the name of the country with the most events and how many events there were. |
Software: | SQL |
Topic: | Testing conditions |
Level: | Relatively easy |
Exercise: | Use IF statements in a SQL stored procedure to return the results of different SELECT statements. |
Software: | SQL |
Topic: | Testing conditions |
Level: | Average difficulty |
Exercise: | Use IF statements in SQL to validate the values passed in to parameters of a stored procedure. |
Software: | SQL |
Topic: | Testing conditions |
Level: | Average difficulty |
Exercise: | Use IF to change the SELECT statement that a stored proc runs. |
Software: | SQL |
Topic: | Scalar functions |
Level: | Relatively easy |
Exercise: | Count the number of letters for an event using a scalar function. |
Software: | SQL |
Topic: | Scalar functions |
Level: | Relatively easy |
Exercise: | Create a user-defined function in SQL Server to calculate album sales certifications. |
Software: | SQL |
Topic: | Scalar functions |
Level: | Relatively easy |
Exercise: | Use a scalar function to include each Dr Who's incarnation dates in a query. |
Software: | SQL |
Topic: | Scalar functions |
Level: | Average difficulty |
Exercise: | Create a function to take in any month number and return the month name. |
Software: | SQL |
Topic: | Scalar functions |
Level: | Average difficulty |
Exercise: | Create a user-defined function in SQL Server to clean up any text passed into it. |
Software: | SQL |
Topic: | Scalar functions |
Level: | Average difficulty |
Exercise: | Use an SQL function within a query to find out the part number of any Dr Who episode. |
Software: | SQL |
Topic: | Scalar functions |
Level: | Harder than average |
Exercise: | Create all sorts of scalar functions in SQL to return info about Dr Who episodes from within a query. |
Software: | SQL |
Topic: | Scalar functions |
Level: | Harder than average |
Exercise: | Create scalar-valued functions in SQL Server to extract information in a list of venues. |
Software: | SQL |
Topic: | Scalar functions |
Level: | Harder than average |
Exercise: | Use a CASE statement to classify each event according to whether it is the top of its class or not. |
Software: | SQL |
Topic: | Transactions |
Level: | Relatively easy |
Exercise: | Create a transaction, add Shaun the Sheep as a Doctor Who, then commit or roll this back. |
Software: | SQL |
Topic: | Transactions |
Level: | Relatively easy |
Exercise: | Use transactions in SQL to control what happens when you modify data in tables. |
Software: | SQL |
Topic: | Transactions |
Level: | Average difficulty |
Exercise: | Create a transaction to update all countries that aren't your own, then roll it back. |
Software: | SQL |
Topic: | Transactions |
Level: | Average difficulty |
Exercise: | Create a transaction which prevents the same event being added multiple times. |
Software: | SQL |
Topic: | Transactions |
Level: | Average difficulty |
Exercise: | Update the number of Dr Who enemies within a transaction, and commit or roll this back. |
Software: | SQL |
Topic: | Transactions |
Level: | Average difficulty |
Exercise: | Use the Insert, Update and Delete commands in a single transaction. |
Software: | SQL |
Topic: | Creating tables |
Level: | Relatively easy |
Exercise: | Use INSERT, UPDATE and DELETE statements in SQL Server to modify data in a table of music artists. |
Software: | SQL |
Topic: | Creating tables |
Level: | Average difficulty |
Exercise: | Create a table of genres for books using CREATE TABLE, then insert a few rows using INSERT INTO. |
Software: | SQL |
Topic: | Creating tables |
Level: | Average difficulty |
Exercise: | Has mistake must fix spelling of millenium!!!!. |
Software: | SQL |
Topic: | Creating tables |
Level: | Average difficulty |
Exercise: | Store useful information about continents in a new permanent table. |
Software: | SQL |
Topic: | Creating tables |
Level: | Average difficulty |
Exercise: | Write a SQL query to create a table of companies, and add two rows to it. |
Software: | SQL |
Topic: | Creating tables |
Level: | Average difficulty |
Exercise: | Write a SQL script to create a table to store movies and use a foreign key to connect it to a table of albums. |
Software: | SQL |
Topic: | Creating tables |
Level: | Harder than average |
Exercise: | Create a table of genres for books, and create a foreign key constraint linking this to a table of authors. |
Software: | SQL |
Topic: | Temporary tables and table variables |
Level: | Relatively easy |
Exercise: | Declare a table variable, and copy the Dr Who companions, enemies and doctors into it. |
Software: | SQL |
Topic: | Temporary tables and table variables |
Level: | Relatively easy |
Exercise: | Try both methods of creating Temporary tables, using INTO and CREATE. |
Software: | SQL |
Topic: | Temporary tables and table variables |
Level: | Relatively easy |
Exercise: | Use a temporary table in SQL Server to store a list of concerts cancelled due to COVID. |
Software: | SQL |
Topic: | Temporary tables and table variables |
Level: | Relatively easy |
Exercise: | Write SQL to put Dr Who rows in a temporary table, and add companions and enemies into this. |
Software: | SQL |
Topic: | Temporary tables and table variables |
Level: | Average difficulty |
Exercise: | Add rows one by one within a loop into a temporary table that you've created. |
Software: | SQL |
Topic: | Temporary tables and table variables |
Level: | Average difficulty |
Exercise: | Use a table variable in SQL Server to store a list of non-charting albums and singles. |
Software: | SQL |
Topic: | Temporary tables and table variables |
Level: | Average difficulty |
Exercise: | Use a table variable to hold useful information from several sources together. |
Software: | SQL |
Topic: | Temporary tables and table variables |
Level: | Average difficulty |
Exercise: | Use a table variable to join one set of data to another table. |
Software: | SQL |
Topic: | Temporary tables and table variables |
Level: | Average difficulty |
Exercise: | Use a temporary table in SQL Server to compile a list of chart-topping albums and singles. |
Software: | SQL |
Topic: | Temporary tables and table variables |
Level: | Average difficulty |
Exercise: | Use a temporary table or table variable to combine the best Doctor Who episodes into a single table. |
Software: | SQL |
Topic: | Temporary tables and table variables |
Level: | Harder than average |
Exercise: | Use a table variable or temporary table to build up a list of database problems in a single table. |
Software: | SQL |
Topic: | Temporary tables and table variables |
Level: | Harder than average |
Exercise: | Use a temporary table or a table variable to collate a set of concert statistics in SQL Server. |
Software: | SQL |
Topic: | Temporary tables and table variables |
Level: | Harder than average |
Exercise: | Write the names of your stored procedures and functions to a temporary table or table variable. |
Software: | SQL |
Topic: | Table-valued functions |
Level: | Relatively easy |
Exercise: | Create a table valued function in SQL Server to return statistics about concerts in a given year. |
Software: | SQL |
Topic: | Table-valued functions |
Level: | Relatively easy |
Exercise: | Create a table-valued function to list events for a given year. |
Software: | SQL |
Topic: | Table-valued functions |
Level: | Relatively easy |
Exercise: | List episodes made by any given doctor by using a table function in SQL. |
Software: | SQL |
Topic: | Table-valued functions |
Level: | Average difficulty |
Exercise: | Create a table-valued function in SQL Server to return a list of singles, albums and tours whose names match a search string. |
Software: | SQL |
Topic: | Table-valued functions |
Level: | Average difficulty |
Exercise: | Create an inline tabled valued function taking two parameters. |
Software: | SQL |
Topic: | Table-valued functions |
Level: | Average difficulty |
Exercise: | Return a table of episodes for a series number and author, using a table-valued function. |
Software: | SQL |
Topic: | Table-valued functions |
Level: | Harder than average |
Exercise: | Show episodes, listing companions or enemies according to parameter, using an MSTVF function. |
Software: | SQL |
Topic: | Table-valued functions |
Level: | Harder than average |
Exercise: | Use a MSTVF to show categories, countries and continents that contain a given vowel. |
Software: | SQL |
Topic: | Derived tables and CTEs |
Level: | Relatively easy |
Exercise: | Create an expression in a common table expression, and group by this in a query using the CTE. |
Software: | SQL |
Topic: | Derived tables and CTEs |
Level: | Relatively easy |
Exercise: | Use a Common Table Expression in a SQL query to categorise music albums according to sales certifications. |
Software: | SQL |
Topic: | Derived tables and CTEs |
Level: | Relatively easy |
Exercise: | Use a Common Table Expression to write a complex query in two distinct parts. |
Software: | SQL |
Topic: | Derived tables and CTEs |
Level: | Relatively easy |
Exercise: | Use a CTE to group a query by a CASE expression without including it twice. |
Software: | SQL |
Topic: | Derived tables and CTEs |
Level: | Relatively easy |
Exercise: | Use a derived table subquery in SQL Server to categorise a list of venues by size. |
Software: | SQL |
Topic: | Derived tables and CTEs |
Level: | Average difficulty |
Exercise: | Create a CTE to show - amazingly easily - events containing the words THIS and THAT, in this order. |
Software: | SQL |
Topic: | Derived tables and CTEs |
Level: | Average difficulty |
Exercise: | Show enemies appearing in chosen episodes, using a Common Table Expression (CTE). |
Software: | SQL |
Topic: | Derived tables and CTEs |
Level: | Average difficulty |
Exercise: | Use a basic CTE to hold filtered data before joining onto another table. |
Software: | SQL |
Topic: | Derived tables and CTEs |
Level: | Average difficulty |
Exercise: | Use a common table expression (CTE) in a SQL query to aggregate information about tracks on albums. |
Software: | SQL |
Topic: | Derived tables and CTEs |
Level: | Average difficulty |
Exercise: | Use a derived table subquery in SQL Server to display details of venues and statistics for concerts. |
Software: | SQL |
Topic: | Derived tables and CTEs |
Level: | Average difficulty |
Exercise: | Use a derived table to hold a select statement. Then join another table on. |
Software: | SQL |
Topic: | Derived tables and CTEs |
Level: | Average difficulty |
Exercise: | Use linked CTEs to show continents having many countries but few events. |
Software: | SQL |
Topic: | Derived tables and CTEs |
Level: | Harder than average |
Exercise: | Create a CTE - common table expression - to display breadcrumbs using recursion. |
Software: | SQL |
Topic: | Derived tables and CTEs |
Level: | Harder than average |
Exercise: | Cretae two CTEs to hold data before joining them together. |
Software: | SQL |
Topic: | Derived tables and CTEs |
Level: | Harder than average |
Exercise: | For each combination of the top 3 categories and top 3 countries, count the number of events using CTEs. |
Software: | SQL |
Topic: | Derived tables and CTEs |
Level: | Harder than average |
Exercise: | Use a series of CTEs to show categories for countries for events not containing the letters OWL. |
Software: | SQL |
Topic: | Derived tables and CTEs |
Level: | Harder than average |
Exercise: | Use common table expressions, subqueries or any other technique to solve a complex query. |
Software: | SQL |
Topic: | Derived tables and CTEs |
Level: | Harder than average |
Exercise: | Use CTEs in a SQL query to return details of venues and statistics of shows held at them. |
Software: | SQL |
Topic: | Derived tables and CTEs |
Level: | Harder than average |
Exercise: | Use derived table subqueries in SQL Server to merge the results of different grouping queries into a single result set. |
Software: | SQL |
Topic: | Dynamic SQL |
Level: | Relatively easy |
Exercise: | Create a stored procedure which can change the name of the table in the FROM clause. |
Software: | SQL |
Topic: | Dynamic SQL |
Level: | Average difficulty |
Exercise: | Create a query which selects whatever columns, sort order and table you pass in as parameters, using dynamic SQL. |
Software: | SQL |
Topic: | Dynamic SQL |
Level: | Average difficulty |
Exercise: | Write a procedure using EXEC which varies the sort column according to the parameter value passed. |
Software: | SQL |
Topic: | Dynamic SQL |
Level: | Harder than average |
Exercise: | Using a comma-delimited list variable filter another select statement using dynamic SQL. |
You can search our full list of SQL exercises here. Or why not learn to do them the right way on one of our SQL training courses? You can attend our online training classes wherever you are in the world!
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2024. All Rights Reserved.