creating tables using t-sql
Posted on 2007-10-14
I would like to create a small database to keep track of songs. I want to avoid keeping multiple copies of the same song that exists on different Albums. I know i need 3 tables: ALBUM, SONG, ARTIST. I also need 2 associative tables that would resolve the many-to-many relationship between the ALBUM-SONG and SONG-ARTIST tables. The ALBUM table should hold the Album id, the Album name, and anything useful. The SONG table hold information about the song name, duration, genre. The ARTIST table hold the artist id, artist/group name, and any useful information How would i create these sql tables by
assign the appropriate data types, Using the identity property where appropriate; and create and name the necessary constraints: primary keys, not null, foreign keys, check;?
I started with this but not sure if i am on the right track?
Create table album
( album_id Int Not Null,
album_name VarChar(50) Not Null)
Create table song
( song_name VarChar(50) Not Null
genre VarChar(50) Not Null)
Create table artist
artist_name VarChar(50) Not Null)