Professional Documents
Culture Documents
USE HimigHandogDB;
);
release_year INT,
);
);
INSERT INTO songs(id,name,length,album_id) VALUES (38,'The Thing That Should Not Be',6+(36/60),4);
INSERT INTO songs(id,name,length,album_id) VALUES (88,'The Grand Inquisitor II: Roots &
Locusts',6+(33/60),9);
INSERT INTO songs(id,name,length,album_id) VALUES (89,'The Grand Inquisitor III: A Tiny Grain of
Faith',1+(56/60),9);
FROM bands;
ORDER BY release_year;
/*Select the OLDEST album*/
ORDER BY release_year
LIMIT 1;
FROM bands
FROM bands AS b
GROUP BY b.id
HAVING num_albums;
SELECT
albums.name as Name,
SUM(songs.length) as 'Duration'
FROM albums
GROUP BY songs.album_id
LIMIT 1;
SELECT
albums.name as Name,
SUM(songs.length) as 'Duration'
FROM albums
GROUP BY songs.album_id
UPDATE albums
WHERE release_year=NULL;
UPDATE albums
WHERE id = 4;
/*Insert a record for your Favorite Band and one of their albums*/
/*Delete the Band and Album that has been created on #9*/
WHERE id=8;
FROM songs;
SELECT
albums.name AS 'Album',
MAX(songs.length)AS 'Duration'
FROM albums
GROUP BY songs.album_id;
FROM songs