{"id":19514829,"url":"https://github.com/marialuizaleitao/record-store","last_synced_at":"2026-06-19T14:31:52.890Z","repository":{"id":213054655,"uuid":"732893291","full_name":"marialuizaleitao/record-store","owner":"marialuizaleitao","description":"A simple interactive SQL project to build a database and retrieve data about the records of a store.","archived":false,"fork":false,"pushed_at":"2023-12-18T05:20:35.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-25T23:41:19.512Z","etag":null,"topics":["mysql-database","sql"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marialuizaleitao.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-12-18T05:18:15.000Z","updated_at":"2024-06-07T20:04:07.000Z","dependencies_parsed_at":"2023-12-18T07:41:39.999Z","dependency_job_id":null,"html_url":"https://github.com/marialuizaleitao/record-store","commit_stats":null,"previous_names":["marialuizaleitao/record-store"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/marialuizaleitao/record-store","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marialuizaleitao%2Frecord-store","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marialuizaleitao%2Frecord-store/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marialuizaleitao%2Frecord-store/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marialuizaleitao%2Frecord-store/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marialuizaleitao","download_url":"https://codeload.github.com/marialuizaleitao/record-store/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marialuizaleitao%2Frecord-store/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34536274,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-19T02:00:06.005Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mysql-database","sql"],"created_at":"2024-11-10T23:37:46.950Z","updated_at":"2026-06-19T14:31:52.874Z","avatar_url":"https://github.com/marialuizaleitao.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Record Store Project\nThis project was based on a YouTube [video](https://youtu.be/30W5wjgJR08).\n\n## Exercise\n### 1. Creating the environment\n\nCopy the code within the [schema](schema.sql) file, paste it into MySQL Workbench and execute it.\nThis code will create and enter the database and the tables Bands and Albums.\n\nNext, you should create a table to store all the Songs.\nThis table should be named `songs` and have four attributes with the following names:\n\n1. `id`: An integer that is the primary key, and auto increments.\n2. `name`: A string that cannot be null.\n3. `length`: A float that represents the length of the song in minutes that cannot be null.\n4. `album_id`: An integer that is a foreign key referencing the albums table that cannot be null.\n\nAfter successfully creating this table, you can copy the code from [data.sql](data.sql) into MySQL Workbench.\nThis code will populate the table and fill it with our data so we can get started with our queries!\n\n### 2. Select only the Names of all the Bands\n\nUsing an Alias, change the name of the column that returns the data to `Band Name`.\nYour query should return something like this:\n\n| Band Name         | \n|-------------------| \n| Seventh Wonder    | \n| Metallica         | \n| The Ocean         | \n| Within Temptation | \n| Death             | \n| Van Canto         | \n| Dream Theater     | \n\n### 3. Select the Oldest Album\n\nTry to return only one result from this query, and not return any albums that do not have a release year.\nThis is the oldest album in the data scheme:\n\n| id | name                   | release_year | band_id | \n|----|------------------------|--------------|---------| \n| 5  | ...And Justice for All | 1988         | 2       | \n\n### 4. Get all Bands that have Albums\n\nThere are multiple solutions to this problem, but they will all involve the use of a join.\nReturn the band name as `Band Name`.\n\n| Band Name         | \n|-------------------| \n| Seventh Wonder    | \n| Metallica         | \n| The Ocean         | \n| Within Temptation | \n| Death             | \n| Van Canto         | \n\n### 5. Get all Bands that have No Albums\n\nReturn the band name as `Band Name`.\n\n| Band Name     | \n|---------------| \n| Dream Theater | \n\n### 6. Get the Longest Album\n\nTip: Use an aggregate function.\nReturn the album name as `Name`, the album release year as `Release Year`, and the album length as `Duration`.\n\n| Name           | Release Year | Duration          | \n|----------------|--------------|-------------------| \n| Death Magnetic | 2008         | 74.76666593551636 | \n\n### 7. Update the Release Year of the Album with no Release Year\n\nSet the release year to 1986.\n\nIf you try to update the release year of a row in MySQL Workbench by using the release_year IS NULL condition in the WHERE statement, you may get an error. This is because MySQL Workbench by default does not allow you to update a table with a primary key without using the primary key in the UPDATE statement. \nThis is a good thing, because it prevents you from accidentally updating the wrong row. To avoid this error, make sure to use the primary key of the row you want to update in the WHERE statement of your UPDATE query.\n\n### 8. Insert a record for your favorite Band and one of their Albums\n\nUse a Select to now see that band and album in your tables.\n\n### 9. Delete the Band and Album you added in #8\n\nIt is important to delete records in the correct order when an album has a foreign key to a band.\n\n### 10. Get the Average Length of all Songs\n\nReturn the average length as `Average Song Duration`.\n\n| Average Song Duration | \n|-----------------------| \n| 5.352472513259112     | \n\n\n### 11. Select the longest Song off each Album\n\nReturn the album name as `Album`, the album release year as `Release Year`, and the longest song length as `Duration`.\n\n| Album                       | Release Year | Duration | \n|-----------------------------|--------------|----------| \n| Tiara                       | 2018         | 9.5      | \n| The Great Escape            | 2010         | 30.2333  | \n| Mercy Falls                 | 2008         | 9.48333  | \n| Master of Puppets           | 1986         | 8.58333  | \n| ...And Justice for All      | 1988         | 9.81667  | \n| Death Magnetic              | 2008         | 9.96667  | \n| Heliocentric                | 2010         | 7.48333  | \n| Pelagial                    | 2013         | 9.28333  | \n| Anthropocentric             | 2010         | 9.4      | \n| Resist                      | 2018         | 5.85     | \n| The Unforgiving             | 2011         | 5.66667  | \n| Enter                       | 1997         | 7.25     | \n| The Sound of Perseverance   | 1998         | 8.43333  | \n| Individual Thought Patterns | 1993         | 4.81667  | \n| Human                       | 1991         | 4.65     | \n| A Storm to Come             | 2006         | 5.21667  | \n| Break the Silence           | 2011         | 6.15     | \n| Tribe of Force              | 2010         | 8.38333  | \n\n### 12. Get the number of Songs for each Band\n\nThis question is one of the most challenging on the list. It will require you to use a double join to solve it.\nReturn the band name as `Band`, the number of songs as `Number of Songs`.\n\n| Band              | Number of Songs | \n|-------------------|-----------------| \n| Seventh Wonder    | 35              | \n| Metallica         | 27              | \n| The Ocean         | 31              | \n| Within Temptation | 30              | \n| Death             | 27              | \n| Van Canto         | 32              | \n\n### Final Script\n\nYou can see the solutions and my final script clicking [here](scriptFinal.sql).\nKeep in mind that your code may look different from mine, because everyone has their own way of solving problems. If you're interested, feel free to send me a message and we can compare our solutions!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarialuizaleitao%2Frecord-store","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarialuizaleitao%2Frecord-store","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarialuizaleitao%2Frecord-store/lists"}