{"id":20636396,"url":"https://github.com/yash1882/music-store-data-analysis","last_synced_at":"2026-01-28T21:32:08.418Z","repository":{"id":255694849,"uuid":"853410727","full_name":"Yash1882/Music-Store-Data-Analysis","owner":"Yash1882","description":"A project focuses on analyzing music store data using SQL ♬","archived":false,"fork":false,"pushed_at":"2024-09-06T16:08:58.000Z","size":210,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-05T17:03:43.172Z","etag":null,"topics":["begineer-friendly","data-analysis","music","music-store-data","music-store-data-analysis","sql-project"],"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/Yash1882.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-06T15:48:07.000Z","updated_at":"2024-09-06T16:26:29.000Z","dependencies_parsed_at":"2024-09-06T19:15:13.454Z","dependency_job_id":null,"html_url":"https://github.com/Yash1882/Music-Store-Data-Analysis","commit_stats":null,"previous_names":["yash1882/music-store-data-analysis"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Yash1882/Music-Store-Data-Analysis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yash1882%2FMusic-Store-Data-Analysis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yash1882%2FMusic-Store-Data-Analysis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yash1882%2FMusic-Store-Data-Analysis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yash1882%2FMusic-Store-Data-Analysis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Yash1882","download_url":"https://codeload.github.com/Yash1882/Music-Store-Data-Analysis/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yash1882%2FMusic-Store-Data-Analysis/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28852774,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T15:15:36.453Z","status":"ssl_error","status_checked_at":"2026-01-28T15:15:13.020Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["begineer-friendly","data-analysis","music","music-store-data","music-store-data-analysis","sql-project"],"created_at":"2024-11-16T15:10:42.021Z","updated_at":"2026-01-28T21:32:08.401Z","avatar_url":"https://github.com/Yash1882.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Music Store Data Analysis ♬\n\nThis project focuses on analyzing music store data with SQL. The dataset has 11 tables: Employee, Customer, Invoice, InvoiceLine, Track, MediaType, Genre, Album, Artist, PlaylistTrack, and Playlist. This project intends to answer many questions and obtain important insights into the music store's operations by applying SQL queries to the dataset.\n\n## Table of Contents\n\n- [Introduction](#introduction)\n- [Dataset](#dataset)\n- [Questions and Answers](#questions-and-answers)\n\t- [Question Set 1 - Easy](#question-set-1---easy)\n\t- [Question Set 2 - Moderate](#question-set-2---moderate)\n\t- [Question Set 3 - Advanced](#question-set-3---advanced)\n- [Project Structure](#project-structure)\n- [Usage](#usage)\n- [Contributing](#contributing)\n\n## Introduction\n\nThe \"Music Store Data Analysis\" project offers a comprehensive analysis of the music store's data to facilitate better decision-making, identify trends, and understand customer behavior. By leveraging SQL queries and data exploration, this project provides valuable answers to optimize inventory management, target marketing campaigns, and make informed business decisions.\n\n## Dataset\n\nThe dataset for this project has 11 tables: Employee, Customer, Invoice, InvoiceLine, Track, MediaType, Genre, Album, Artist, PlaylistTrack, and Playlist, as well as their associations.\n\n![Schema](https://imgur.com/UU2tQp7.png)\n\n## Questions and Answers\n\n#### Question Set 1 - Easy\n\nQ1. Who is the most senior employee based on job title? \n\n```sql\nSELECT * FROM EMPLOYEE\nORDER BY LEVELS DESC\nLIMIT 1;\n```\n\nQ2. Which countries have the most Invoices?\n\n```sql\nSELECT BILLING_COUNTRY, COUNT(*) AS Most_Invoices FROM INVOICE\nGROUP BY BILLING_COUNTRY\nORDER BY Most_Invoices DESC;\n```\n\nQ3. What are top 3 values of total invoice?\n\n```sql\nSELECT TOTAL FROM INVOICE\nORDER BY TOTAL DESC\nLIMIT 3;\n```\n\nQ4. Which city has the best customers? \n- We would like to throw a promotional Music Festival in the city we made the most money. \n- Write a query that returns one city that has the highest sum of invoice totals. \n- Return both the city name \u0026 sum of all invoice totals.\n\n```sql\nSELECT BILLING_CITY, SUM(TOTAL) AS Invoice_Total FROM INVOICE\nGROUP BY BILLING_CITY\nORDER BY Invoice_Total DESC\nLIMIT 1;\n```\n\nQ5. Who is the best customer? \n- The customer who has spent the most money will be declared the best customer. \n- Write a query that returns the person who has spent the most money.\n\n```sql\nSELECT C.CUSTOMER_ID, C.FIRST_NAME, C.LAST_NAME, SUM(I.TOTAL) AS TOTAL_AMOUNT\nFROM CUSTOMER AS C\nJOIN INVOICE AS I\nON C.CUSTOMER_ID = I.CUSTOMER_ID\nGROUP BY C.CUSTOMER_ID\nORDER BY TOTAL_AMOUNT DESC\nLIMIT 1;\n```\n\n#### Question Set 2 - Moderate\n\nQ1. Write query to return the email, first name, last name, \u0026 Genre of all Rock Music listeners. \n- Return your list ordered alphabetically by email starting with A.\n\n```sql\nSELECT DISTINCT CUS.EMAIL, CUS.FIRST_NAME, CUS.LAST_NAME\nFROM CUSTOMER AS CUS\nJOIN INVOICE AS INV ON CUS.CUSTOMER_ID = INV.CUSTOMER_ID\nJOIN INVOICE_LINE AS INVL ON INV.INVOICE_ID = INVL.INVOICE_ID\nWHERE INVL.TRACK_ID IN(\n SELECT T.TRACK_ID\n FROM TRACK AS T\n JOIN GENRE AS G ON T.GENRE_ID = G.GENRE_ID\n WHERE G.NAME LIKE 'Rock'\n)\nORDER BY CUS.EMAIL;\n```\n\nQ2. Let's invite the artists who have written the most rock music in our dataset. \n- Write a query that returns the Artist name and total track count of the top 10 rock bands.\n\n```sql\nSELECT AR.NAME, COUNT(AR.ARTIST_ID) AS NUMBER_OF_SONGS\nFROM TRACK AS TR\nJOIN ALBUM AS AL ON TR.ALBUM_ID = AL.ALBUM_ID\nJOIN ARTIST AS AR ON AL.ARTIST_ID = AR.ARTIST_ID\nJOIN GENRE AS GE ON TR.GENRE_ID = GE.GENRE_ID\nWHERE GE.NAME LIKE 'Rock'\nGROUP BY AR.ARTIST_ID\nORDER BY NUMBER_OF_SONGS DESC LIMIT 10;\n```\n\nQ3. Return all the track names that have a song length longer than the average song length. \n- Return the Name and Milliseconds for each track. \n- Order by the song length with the longest songs listed first.\n\n```sql\nSELECT NAME, MILLISECONDS\nFROM TRACK\nWHERE MILLISECONDS \u003e (\n SELECT AVG(MILLISECONDS) AS AVG_SONG_LENGTH\n FROM TRACK\n)\nORDER BY MILLISECONDS DESC;\n```\n\n#### Question Set 3 - Advanced\n\nQ1. Find how much amount spent by each customer on artists? \n- Write a query to return customer name, artist name and total spent.\n\n```sql\nWITH BEST_SELLING_ARTIST AS (\n\tSELECT ART.ARTIST_ID, ART.NAME, SUM(IVL.UNIT_PRICE * IVL.QUANTITY) AS TOTAL_AMOUNT\n\tFROM INVOICE_LINE AS IVL\n\tJOIN TRACK AS TRK ON IVL.TRACK_ID = TRK.TRACK_ID\n\tJOIN ALBUM AS ALB ON TRK.ALBUM_ID = ALB.ALBUM_ID\n\tJOIN ARTIST AS ART ON ALB.ARTIST_ID = ART.ARTIST_ID\n\tGROUP BY ART.ARTIST_ID\n\tORDER BY TOTAL_AMOUNT DESC LIMIT 1\n)\nSELECT CUS.CUSTOMER_ID, CUS.FIRST_NAME, CUS.LAST_NAME, BSA.NAME AS ARTIST_NAME, SUM(IVL.UNIT_PRICE * IVL.QUANTITY) AS AMOUNT_SPENT\nFROM INVOICE AS INV\nJOIN CUSTOMER AS CUS ON INV.CUSTOMER_ID = CUS.CUSTOMER_ID\nJOIN INVOICE_LINE AS IVL ON INV.INVOICE_ID = IVL.INVOICE_ID\nJOIN TRACK AS TRK ON IVL.TRACK_ID = TRK.TRACK_ID\nJOIN ALBUM AS ALB ON TRK.ALBUM_ID = ALB.ALBUM_ID\nJOIN BEST_SELLING_ARTIST AS BSA ON ALB.ARTIST_ID = BSA.ARTIST_ID\nGROUP BY CUS.CUSTOMER_ID, BSA.NAME;\n```\n\nQ2. We want to find out the most popular music Genre for each country. \n- We determine the most popular genre as the genre with the highest amount of purchases. \n- Write a query that returns each country along with the top Genre. \n- For countries where the maximum number of purchases is shared return all Genres.\n\n```sql\nWITH POPULAR_GENRE AS (\n\tSELECT CU.COUNTRY, COUNT(IL.QUANTITY) AS TOTAL_PURCHASES, GE.NAME AS TOP_GENRE, GE.GENRE_ID,\n\t\tROW_NUMBER() OVER(\n\t\t\tPARTITION BY CU.COUNTRY ORDER BY COUNT(IL.QUANTITY) DESC\n\t\t) AS ROW_NUM\n\tFROM CUSTOMER AS CU\n\tJOIN INVOICE AS IV ON CU.CUSTOMER_ID = IV.CUSTOMER_ID\n\tJOIN INVOICE_LINE AS IL ON IV.INVOICE_ID = IL.INVOICE_ID\n\tJOIN TRACK AS TR ON IL.TRACK_ID = TR.TRACK_ID\n\tJOIN GENRE AS GE ON TR.GENRE_ID = GE.GENRE_ID\n\tGROUP BY CU.COUNTRY, GE.NAME, GE.GENRE_ID\n\tORDER BY CU.COUNTRY, TOTAL_PURCHASES DESC\n)\nSELECT COUNTRY, TOP_GENRE, TOTAL_PURCHASES\nFROM POPULAR_GENRE WHERE ROW_NUM = 1;\n```\n\nQ3. Write a query that determines the customer that has spent the most on music for each country. \n- Write a query that returns the country along with the top customer and how much they spent. \n- For countries where the top amount spent is shared, provide all customers who spent this amount.\n\n```sql\nWITH CUSTOMER_WITH_COUNTRY AS (\n\tSELECT CU.COUNTRY, CU.CUSTOMER_ID, CU.FIRST_NAME, CU.LAST_NAME, SUM(IV.TOTAL) AS AMOUNT_SPENT,\n\t\tROW_NUMBER() OVER(\n\t\t\tPARTITION BY CU.COUNTRY ORDER BY SUM(IV.TOTAL) DESC\n\t\t) AS ROW_NUM\n\tFROM INVOICE AS IV\n\tJOIN CUSTOMER AS CU ON IV.CUSTOMER_ID = CU.CUSTOMER_ID\n\tGROUP BY CU.COUNTRY, CU.CUSTOMER_ID, CU.FIRST_NAME, CU.LAST_NAME\n\tORDER BY CU.COUNTRY, AMOUNT_SPENT DESC\n)\nSELECT COUNTRY, CUSTOMER_ID, FIRST_NAME, LAST_NAME, AMOUNT_SPENT\nFROM CUSTOMER_WITH_COUNTRY\nWHERE ROW_NUM = 1;\n```\n\n## Project Structure\n\nThe project repository is structured as follows:\n\n```\n├── data/                  # Directory containing the dataset\n├── queries/               # Directory containing SQL query files\n└── README.md              # Project README file\n```\n\n## Usage\n\n1. Clone the repository:\n\n   ```\n   git clone https://github.com/Yash1882/Music-Store-Data-Analysis.git\n   ```\n\n2. Import the dataset into your SQL database management system.\n\n3. Run SQL queries located in the `queries/` directory against the database to perform data analysis and generate insights.\n\n## Contributing\n\nContributions to this project are welcome. If you have suggestions for improvements or find any issues, feel free to open a pull request or submit an issue in the repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyash1882%2Fmusic-store-data-analysis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyash1882%2Fmusic-store-data-analysis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyash1882%2Fmusic-store-data-analysis/lists"}