Unique genres (chinook database)
Welcome to this SQL lab where you'll be tested on your skills using the chinook
database. This database, representative of a digital media store, contains several tables that encapsulate information about artists, albums, tracks, invoices, and more.
Objective
Your goal is to craft SQL queries that accurately retrieve or manipulate data as specified in each challenge. Make sure to use correct table and column names as given in the database schema to ensure your solutions are accurate.
Instructions
-
Database Connection: The environment is pre-configured. You do not need to set up any connections. Simply start writing your SQL queries.
-
Table & Column Names: Ensure you reference tables and columns using their exact names as defined in the chinook database schema. It's recommended to use double quotes around table and column names for clarity. Example:
"Genre"."Name"
. -
Order of Results: To ensure that your results match the expected output, always use an
ORDER BY
clause in your queries, wherever applicable. Remember that the order matters when the system evaluates your solution against the expected output.
Challenge
Retrieve a list of all unique music genres present in the chinook database. The genres should be presented in an alphabetically sorted manner. The output should contain a column labeled as "Name"
, and the results should be ordered alphabetically by the "Name"
column.
Hint: Make use of the DISTINCT
keyword and ORDER BY
clause.
NOTE: It's crucial to ensure your SQL queries are not only syntactically correct but also semantically accurate. Double-check your column names and ensure they match with the expected column names. Ensure you follow the constraints and hints provided for each challenge.
Good luck and happy querying!