The given SQL creates an Album table and a Song table. The SHOW COLUMNS queries show information about the…

The given SQL creates an Album table and a Song table. The SHOW COLUMNS queries show information about the…

Question:

 

Transcribed Image Text:

The given SQL creates an Album table and a Song table. The SHOW COLUMNS queries show information about the Album and
Song table columns.
Modify the two CREATE TABLE statements:
1. Add a primary key constraint to the Album table’s ID column.
2. Add a primary key constraint to the Song table’s ID column.
3. Add a foreign key constraint to the Song table so the AlbumID column refers to the Album table’s ID column.
1 Add a primary key
2 CREATE TABLE Album (
3
ID INT,
4
Title VARCHAR(60),
5
ReleaseYear INT
6);
7
8
9 CREATE TABLE Song (
10
ID INT,

Add primary and foreign keys
11
Title VARCHAR(60),
12 Artist VARCHAR (60),
13 AlbumID INT
14);
15
16 SHOW COLUMNS
17 FROM Album;
18
19 SHOW COLUMNS
20 FROM Song; The given SQL creates an Album table and a Song table. The SHOW COLUMNS queries show information about the Album and
Song table columns.
Modify the two CREATE TABLE statements:
1. Add a primary key constraint to the Album table’s ID column.
2. Add a primary key constraint to the Song table’s ID column.
3. Add a foreign key constraint to the Song table so the AlbumID column refers to the Album table’s ID column.
1 Add a primary key
2 CREATE TABLE Album (
3
ID INT,
4
Title VARCHAR(60),
5
ReleaseYear INT
6);
7
8
9 CREATE TABLE Song (
10
ID INT,

Add primary and foreign keys
11
Title VARCHAR(60),
12 Artist VARCHAR(60),
13 AlbumID INT
14);
15
16 SHOW COLUMNS
17 FROM Album;
18
19 SHOW COLUMNS
20 FROM Song;

Expert Answer:

Answer rating: 100% (QA)

To modify the CREATE TABLE statements to add a primary key constraint to the Album table s ID column
View the full answer