Music Database

DOWNLOAD

Note to self: move these files to a github repository… but only if you have time :)

Intro

Follow along with the SQL examples you see on this site with my music Database. This is a database that attempts to mimic how data would be stored for something like a Spotify clone.

Database Diagram

image-center

Readme

CREATE SCHEMA

Before you run the create table statements, you will need to create the named schema music. This is named schema is just some good housekeeping that helps organise our tables.

If you already have this named schema in use in your database then you can skip this step! But you might want to consider using a different named schema instead!

CREATE SCHEMA music;

CREATE TABLE statements

Next run the statements in createdb.sql.

INSERT statements

Then run the statements in inserts.sql

DROP TABLES

If you wish to remove these tables from your database then you can run the below statement. The foreign key constraints dictate that these tables must be dropped in a specfic order.

	DROP TABLE 
		music.PlaylistTrack
	,	music.Playlist		
	,	music.PerformsOnSong	
	,	music.Follows
	,	music.Users	
	,	music.AlbumTrack		
	,	music.Album		
	,	music.Song		 
	,	music.Artist
	,	music.Account;