Overview
This lab consists of two parts: importing DVD database (needed for Assignment 7) and writing SELECT SQL statements against the song database. Submit the .sql
file on BlackBoard when you finish.
Requirements
Part 1 – DVD Database Import
- Download dvd.sql file.
- Create a new database in cPanel → MySQL Databases.
- Name it
username_dvd_db
(cPanel will prefix your username for you automatically). - For example:
ttrojan_dvd_db
.
- Name it
- Import
dvd.sql
file to the newly created database.- cPanel → PHPMyAdmin → [Click on username_dvd_db Database] → Import.
- Verify all tables exist and are populated with data.
- All tables and relationships should match the figure below.
Part 2 – Song Database SELECT SQL Statements
Open up MySQL Workbench and create one .sql
file. In this file, you will write four SQL statements. Above each statement, write a comment with the below prompt.
Important: Use JOIN
statements when querying from multiple tables as taught in lecture. Do NOT select multiple tables on FROM
statement. See this stackoverflow link for more info and also this piazza post.
- Display albums that have ‘on’ somewhere in the album title. Sort results in alphabetical order by album title.
Sample results:
- Same as #1, but only show album title and artist name (no
artist_id
) columns.
Sample results:
- Display tracks that have
AAC audio file
format. Only show track name (use alias:track_name
), composer, media type name (use alias:media_type
), and unit price columns.- Use
media_type_id
column for comparison instead of media type name.
Sample results:
- Use
- Display R&B/Soul and Jazz tracks that have a composer (not NULL). Sort results in reverse-alphabetical order by track name. Only show track ID, track name (use alias:
track_name
), composer, milliseconds, and genre name (use alias:genre_name
) columns.- Use
genre_id
column for comparison instead of genre name.
Sample results:
- Use
Submission
When complete, you must upload the completed .sql
file on Blackboard. Go to Assignments/Labs -> Lab 8: SELECT Statements and upload the file.