By Eliza Febriana
This database is a personalized media library manager inspired by Spotify, Goodreads, and Letterboxd, created for CS50 SQL. It allows users to organize their favorite music, books, and movies, and create custom lists to group them.
Included in scope:
- Favorite artists (with country and debut year)
- Favorite authors (with country and birth year)
- Favorite directors (with country and birth year)
- Albums for each artist
- Songs for each album
- Books with publication year and pages
- Movies with release year and duration
- Custom lists (generalized beyond music playlists) to organize any items
- Items in lists with ordering and type
Out of scope:
- Playback of audio/video
- Cover art, ratings, or reviews
- User accounts or permissions
- Collaborative sharing
The database supports:
- Adding, viewing, and managing artists, authors, and directors
- Adding albums for artists, and songs for each album
- Adding books and linking them to authors
- Adding movies and linking them to directors
- Creating general lists and adding any item (song, book, movie) to a list
- Ordering items within lists
- Querying media metadata (e.g., song length, book pages, movie duration)
All entities are represented as SQLite tables:
id:INTEGER PRIMARY KEYname:TEXT NOT NULLcountry:TEXTdebut_year:INTEGER
id:INTEGER PRIMARY KEYtitle:TEXT NOT NULLartist_id:INTEGER NOT NULL(foreign key toartists.id)release_year:INTEGER
id:INTEGER PRIMARY KEYtitle:TEXT NOT NULLalbum_id:INTEGER NOT NULL(foreign key toalbums.id)duration:INTEGER NOT NULL(in seconds)track_number:INTEGER
id:INTEGER PRIMARY KEYname:TEXT NOT NULLcountry:TEXTbirth_year:INTEGER
id:INTEGER PRIMARY KEYtitle:TEXT NOT NULLauthor_id:INTEGER NOT NULL(foreign key toauthors.id)publication_year:INTEGERpages:INTEGER
id:INTEGER PRIMARY KEYname:TEXT NOT NULLcountry:TEXTbirth_year:INTEGER
id:INTEGER PRIMARY KEYtitle:TEXT NOT NULLdirector_id:INTEGER NOT NULL(foreign key todirectors.id)release_year:INTEGERduration:INTEGER(in minutes)
id:INTEGER PRIMARY KEYname:TEXT NOT NULLcreated_at:TIMESTAMP DEFAULT CURRENT_TIMESTAMP
list_id:INTEGER NOT NULL(foreign key tolists.id)item_type:TEXT NOT NULL(must be one of:song,book,movie)item_id:INTEGER NOT NULL(references the appropriate id depending on type)position:INTEGERPRIMARY KEY (list_id, item_type, item_id)
- An artist can have many albums
- An album belongs to one artist and contains many songs
- An author can write many books
- A director can direct many movies
- A list can hold many items of any type (song, book, movie), using
list_itemsto track positions and types
Favorite media included:
Artists:
- Radiohead
- The Verve
- The Smiths
- LANY
- Fleetwood Mac
Authors:
- Mitch Albom
- Paulo Coelho
- Fyodor Dostoevsky
- Emily Henry, and others
Directors:
- Quentin Tarantino
- Martin Scorsese
- Stanley Kubrick
- David Fincher, and others
Sample lists:
- Late Night Chill (music playlist)
- Summer Reads (book list)
- Top Movies (movie list)
- Composite primary keys on
playlist_songsandlist_itemsto avoid duplicate entries - Foreign key constraints maintain referential integrity
- Durations stored in integers for easier calculations
- Highly normalized design for scalability
- Single user only
- No ratings, genres, or reviews yet
- No search indexes beyond default primary keys
- No support for collaborative lists
