SlideShare a Scribd company logo
1 of 3
The Thousand Song Database, 40 pts
You have been provided with a table containing 1,000 songs. Your job is to design a database
to properly store the data, and then write queries to process the data.
Begin by importing the music.sql file into your database. To do so:
1. Log into phpMyAdmin and select your database.
2. Click the Import button.
3. Click Choose File and navigate to music.sql.
4. Click Go.
5. Click the Refresh button to see your new table.
6. Select the table to view the contents.
Create a project portfolio that includes the documentation or SQL statements for each task
below. Include your query results. (For large result sets, just include a small sample.) Your
portfolio should be professional and well-formatted, and should include a portfolio folder
and a cover page. (3 pts) The point value for each item below is shown in parentheses.
I. Identify at least three problems with the data in its current form. Be specific, and
provide examples where possible. (3)
II. Draw an ER diagram that: (10)
a. Displays each entity that is represented in the music table, and the attributes
that belong to each entity.
b. Assigns a primary key to each entity.
c. Indicates the relationships between the entities. Include minimum cardinality.
If you need to make any assumptions, document them, and explain your
rationale.
d. Implements the relationships between entities by adding linking columns
(foreign keys) and linking tables, as appropriate.
Justify and explain your design decisions, in writing. Test your design by making
sure you’ll be able to write the queries in part VI, below.
III. Write SQL statements (by hand) to create the new tables in your database. (5)
Make sure to:
a. Select the best data type for each column.
b. Define primary and foreign keys.
c. Define at least one required column, other than a primary key.
d. Specify at least one default value.
IV. Write statements to add at least one sample row to each of your tables. (1)
V. Write statements to populate your new tables based on the original music table.
You may want to review the INSERT-SELECT construct. Efficiency will be
considered! (5)
VI. Write statements to perform the following queries against your database. (10)
a. Display the names and plays for the 5 most popular songs (i.e. those that have
been played the most times).
b. Produce a list of Jazz and R&B songs that are less than two minutes long.
c. Display all albums that contain Rock (e.g. Rock, Punk Rock, Classic Rock) in
the genre, and were published between 2010 and 2013.
d. Delete the song Sleep Don’t Weep by Damien Rice.
e. For each song in the library, display the song name, artist, album, time, and
genre.
f. Display the average song length by genre. The columns should be titled
“Genre” and “Avg Length”.
g. Display the total number of songs for each genre that has at least 20 songs.
h. For each song, display the song name, artist, album, and genre. Include singles,
i.e. songs that do not have an album.
i. Change the genre for the album “9” to Alternative, using a single statement.
j. Find the names and times of songs that are longer than the average play time.
VII. Create a view called Top20 that displays the song title, artist, and album for the
20 most popular songs (those with the most plays). Display all the rows in the
view. (3)
Extra Credit:
I. Write a query that shows the titles and artists for songs belonging to the genre with
the most songs. Use a single query, and do not assume that you know which genre
has the most songs. (1)
II. Find a list of songs and times where the times are longer than the average time for
the song’s genre. Note: This one is super tricky! (2)
III. Show a list of songs and times for the songs that have the same time as another song.
Sample results are shown below. Note: This one is super duper tricky! (2)
IV. Based on the queries you wrote in part VI above, determine which columns in the
music database would make the best candidates for indexes, and decide what type of
index would be appropriate for each. Justify your choices. Write statements to create
the indexes. (1)
V. Write a one page double-spaced analysis describing how you would secure your
music database. Include at least two users and two permission levels, and define
what actions each level would allow, and the statements you would use to create the
users and assign the permissions. (2)

More Related Content

Similar to The Thousand Song Database

Objective JOIN data in the tables created in the music dat.pdf
Objective  JOIN data in the tables created in the music dat.pdfObjective  JOIN data in the tables created in the music dat.pdf
Objective JOIN data in the tables created in the music dat.pdfadvancethchnologies
 
2020 midterm prof.docxIT 240 Midterm Proficiency Exam .docx
2020 midterm prof.docxIT 240 Midterm Proficiency Exam        .docx2020 midterm prof.docxIT 240 Midterm Proficiency Exam        .docx
2020 midterm prof.docxIT 240 Midterm Proficiency Exam .docxnovabroom
 
Cover Page & Table of Contents
Cover Page & Table of ContentsCover Page & Table of Contents
Cover Page & Table of ContentsMichael Peterson
 
Overview This assignment is designed to have you practice working wit.pdf
 Overview This assignment is designed to have you practice working wit.pdf Overview This assignment is designed to have you practice working wit.pdf
Overview This assignment is designed to have you practice working wit.pdfkarthik12341
 
Case Problem: Music.xlsx
Case Problem: Music.xlsxCase Problem: Music.xlsx
Case Problem: Music.xlsxViscKand
 
ParamsThe interface must be pleasing to look at (a basic form wit.docx
ParamsThe interface must be pleasing to look at (a basic form wit.docxParamsThe interface must be pleasing to look at (a basic form wit.docx
ParamsThe interface must be pleasing to look at (a basic form wit.docxMARRY7
 

Similar to The Thousand Song Database (8)

Objective JOIN data in the tables created in the music dat.pdf
Objective  JOIN data in the tables created in the music dat.pdfObjective  JOIN data in the tables created in the music dat.pdf
Objective JOIN data in the tables created in the music dat.pdf
 
2020 midterm prof.docxIT 240 Midterm Proficiency Exam .docx
2020 midterm prof.docxIT 240 Midterm Proficiency Exam        .docx2020 midterm prof.docxIT 240 Midterm Proficiency Exam        .docx
2020 midterm prof.docxIT 240 Midterm Proficiency Exam .docx
 
Cover Page & Table of Contents
Cover Page & Table of ContentsCover Page & Table of Contents
Cover Page & Table of Contents
 
Overview This assignment is designed to have you practice working wit.pdf
 Overview This assignment is designed to have you practice working wit.pdf Overview This assignment is designed to have you practice working wit.pdf
Overview This assignment is designed to have you practice working wit.pdf
 
Case Problem: Music.xlsx
Case Problem: Music.xlsxCase Problem: Music.xlsx
Case Problem: Music.xlsx
 
ParamsThe interface must be pleasing to look at (a basic form wit.docx
ParamsThe interface must be pleasing to look at (a basic form wit.docxParamsThe interface must be pleasing to look at (a basic form wit.docx
ParamsThe interface must be pleasing to look at (a basic form wit.docx
 
Access1
Access1Access1
Access1
 
Access1
Access1Access1
Access1
 

The Thousand Song Database

  • 1. The Thousand Song Database, 40 pts You have been provided with a table containing 1,000 songs. Your job is to design a database to properly store the data, and then write queries to process the data. Begin by importing the music.sql file into your database. To do so: 1. Log into phpMyAdmin and select your database. 2. Click the Import button. 3. Click Choose File and navigate to music.sql. 4. Click Go. 5. Click the Refresh button to see your new table. 6. Select the table to view the contents. Create a project portfolio that includes the documentation or SQL statements for each task below. Include your query results. (For large result sets, just include a small sample.) Your portfolio should be professional and well-formatted, and should include a portfolio folder and a cover page. (3 pts) The point value for each item below is shown in parentheses. I. Identify at least three problems with the data in its current form. Be specific, and provide examples where possible. (3) II. Draw an ER diagram that: (10) a. Displays each entity that is represented in the music table, and the attributes that belong to each entity. b. Assigns a primary key to each entity. c. Indicates the relationships between the entities. Include minimum cardinality. If you need to make any assumptions, document them, and explain your rationale. d. Implements the relationships between entities by adding linking columns (foreign keys) and linking tables, as appropriate. Justify and explain your design decisions, in writing. Test your design by making sure you’ll be able to write the queries in part VI, below. III. Write SQL statements (by hand) to create the new tables in your database. (5) Make sure to: a. Select the best data type for each column. b. Define primary and foreign keys. c. Define at least one required column, other than a primary key. d. Specify at least one default value. IV. Write statements to add at least one sample row to each of your tables. (1) V. Write statements to populate your new tables based on the original music table. You may want to review the INSERT-SELECT construct. Efficiency will be
  • 2. considered! (5) VI. Write statements to perform the following queries against your database. (10) a. Display the names and plays for the 5 most popular songs (i.e. those that have been played the most times). b. Produce a list of Jazz and R&B songs that are less than two minutes long. c. Display all albums that contain Rock (e.g. Rock, Punk Rock, Classic Rock) in the genre, and were published between 2010 and 2013. d. Delete the song Sleep Don’t Weep by Damien Rice. e. For each song in the library, display the song name, artist, album, time, and genre. f. Display the average song length by genre. The columns should be titled “Genre” and “Avg Length”. g. Display the total number of songs for each genre that has at least 20 songs. h. For each song, display the song name, artist, album, and genre. Include singles, i.e. songs that do not have an album. i. Change the genre for the album “9” to Alternative, using a single statement. j. Find the names and times of songs that are longer than the average play time. VII. Create a view called Top20 that displays the song title, artist, and album for the 20 most popular songs (those with the most plays). Display all the rows in the view. (3) Extra Credit: I. Write a query that shows the titles and artists for songs belonging to the genre with the most songs. Use a single query, and do not assume that you know which genre has the most songs. (1) II. Find a list of songs and times where the times are longer than the average time for the song’s genre. Note: This one is super tricky! (2) III. Show a list of songs and times for the songs that have the same time as another song. Sample results are shown below. Note: This one is super duper tricky! (2)
  • 3. IV. Based on the queries you wrote in part VI above, determine which columns in the music database would make the best candidates for indexes, and decide what type of index would be appropriate for each. Justify your choices. Write statements to create the indexes. (1) V. Write a one page double-spaced analysis describing how you would secure your music database. Include at least two users and two permission levels, and define what actions each level would allow, and the statements you would use to create the users and assign the permissions. (2)