Basic SQL Practice Grounds

Last modified: August 09, 2021

You’re through the basics of SQL! This is a great place to stop and get more practice on what you’ve learned so far. Here we’ve constructed a list of challenges to give you that practice. Take some time to go through these before moving on to the Mid-Level SQL section.

A few things to keep in mind when going through

  • If no specific columns or values are called out to return, assume that it’s asking for all the columns (splat *).
  • If it does ask for specific information like “names”, only return that column. If you return other things as well it won’t be able to match the correct answer.
  • If you’re having trouble with a question use the ‘Hint’ button. If you’re really having trouble or think that the answer might be wrong, send us a note at [email protected].
  • We check if things are correct not by the query you wrote, but by the results that are returned. This is the best way as there are often a few different ways to get the same result.

Good luck!

Q. Fetch the first 8 rows of the albums table.

references: select limit

Q. Fetch the 12th through 32nd (21 total) rows of the tracks table.

references: select limit

Q. Fetch the 9th through 49th (41 total) rows of the artists table.

references: limit

Q. Get the names of all of the artists.

references: from

Q. Get the names of all of the artists in reverse alphabetical order. (Z to A)

references: order-by

Q. Get only the last 4 names of the artists sorted alphabetically.

references: order-by limit

Q. Get the rows of the 20 longest tracks.

references: order-by limit

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.

Written by: Dave Fowler
Reviewed by: Matt David