· 7 years ago · Nov 03, 2018, 11:38 PM
1drop table if exists singers;
2drop table if exists albums;
3PRAGMA foreign_keys = ON;
4
5create table singers ( sid Integer, s_name CHAR(30), origin CHAR(20), PRIMARY KEY(sid));
6
7create table albums (aid Integer, a_name CHAR(30), year INTEGER, rating Integer, sid INTEGER NOT NULL, genre CHAR(20), PRIMARY KEY(aid), FOREIGN KEY (sid) REFERENCES singers);
8
9INSERT INTO singers VALUES( 1, 'Taylor Swift', 'US');
10INSERT INTO singers VALUES( 2, 'Bryan Adams', 'Canada');
11INSERT INTO singers VALUES( 3, 'Drake', 'Canada');
12INSERT INTO singers VALUES( 4, 'Sia', 'Australia');
13
14INSERT INTO albums VALUES( 1, '1000 Forms of Fear', 2013 , 5, 4, 'Pop');
15INSERT INTO albums VALUES( 2, '18 till I Die', 1996, 4, 2, 'Rock');
16INSERT INTO albums VALUES( 3, 'Waking Up the Neighbours', 1991, 5, 2, 'Pop');
17INSERT INTO albums VALUES( 4, '1989', 2014, 4, 1, 'Pop');
18INSERT INTO albums VALUES( 5, 'Scorpion', 2018, 4, 3, 'Rock');