You’ve covered the majority of the main use cases of SQL! You know the stuff, but now you’ve got some practicing to do to become really fluent and skilled at it. Here we’ve constructed a large list of challenges to give you that practice. If you forgot the rules of our practice playgrounds you can review them in the Basic SQL Practice page.
Q. Fetch all the tracks that are over 300000 milliseconds long.
Q. Fetch the id for the artist ‘Miles Davis’.
Q. Get the artists who’s ids are between 55 and 98.
Q. Get all the tracks except those with genre_ids of 15 or 18.
Q. Get all the tracks that were composed by just Miles Davis
Q. Get all the tracks that Miles Davis had a part in composing.
Q. Fetch the the names of the tracks with the word ‘wild’ in it, regardless of case
Q. How many tracks with genre_id of 1 have composers listed?
Q. How many unique composers are there in the tracks table with the genre_id of 1.
Q. What is the average length for tracks with genre_ids of either 5, 7 or 10?
Q. Get a list of genre_ids and the number of tracks in each.
Q. A list of the number of tracks grouped by genre_id and then album_id with the column order of genre_id, album_id and count.
Q. Take the above query, but order the album_id in descending order, keeping genre_id odered the same
Q. Take the above query with the same ordering but group by album_id and then group_id and change the order of the results to reflect that switch.
Q. There is a foreign key customer_id that relates invoices to the customers table. Fetch the company name in the company column of the customers table and the total amount that each has been invoiced by joining these tables.”
Q. Get the first_names and birth_dates of each of the employees in the format: January 01, 1976
Q. Get the first_names and birth_dates of each of the employees in the format: Jan 1st, 1976
Q. Get the first_names and birth_dates of each of the employees in the format: 09/23/1987
Q. Get the year of the invoice_date in the format
Y2012 and total number of invoices per year.
Q. Get the month of invoices and the total amount that was invoiced for that month.
If you’ve completed all of these CONGRATULATIONS! You’re proficient and fluent enough in SQL now to complete a significant portion of analytic and transactional queries.