Skip to content

Commit 3fa9d0e

Browse files
Fix Typos
1 parent 0e7765c commit 3fa9d0e

File tree

12 files changed

+43
-25
lines changed

12 files changed

+43
-25
lines changed

README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ This table should be called `songs` and have four properties with these exact na
2323
After successfully creating the table copy the code from [data.sql](data.sql) into MySQL Workbench, and run it to populate all of the data for the rest of the exercises. If you do not encounter any errors, then your answer is most likely correct.
2424

2525
### 2. Select only the Names of all the Bands
26-
[Results](results/2.txt)
2726
[Solution](solutions/2.sql)
2827

2928
Change the name of the column the data returns to `Band Name`
@@ -100,19 +99,19 @@ If you performed this correctly you should be able to now see that band and albu
10099
### 9. Delete the Band and Album you added in #8
101100
[Solution](solutions/9.sql)
102101

103-
The order of how you delete the record is important since album has a foreign key to band.
102+
The order of how you delete the records is important since album has a foreign key to band.
104103

105104
### 10. Get the Average Length of all Songs
106105
[Solution](solutions/10.sql)
107106

108107
Return the average length as `Average Song Duration`.
109108

110-
| Average Song Length |
111-
|---------------------|
112-
| 5.352472513259112 |
109+
| Average Song Duration |
110+
|-----------------------|
111+
| 5.352472513259112 |
113112

114113

115-
### 11. Select the longest Song Length of each Album
114+
### 11. Select the longest Song off each Album
116115
[Solution](solutions/11.sql)
117116

118117
Return the album name as `Album`, the album release year as `Release Year`, and the longest song length as `Duration`.
@@ -138,10 +137,10 @@ Return the album name as `Album`, the album release year as `Release Year`, and
138137
| Break the Silence | 2011 | 6.15 |
139138
| Tribe of Force | 2010 | 8.38333 |
140139

141-
### 11. Get the number of Songs for each Band
140+
### 12. Get the number of Songs for each Band
142141
[Solution](solutions/12.sql)
143142

144-
This is the toughest question on the list. It will require you to chain together two joins instead of just one.
143+
This is one of the toughest question on the list. It will require you to chain together two joins instead of just one.
145144

146145
Return the band name as `Band`, the number of songs as `Number of Songs`.
147146

schema.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ CREATE DATABASE record_company;
22
USE record_company;
33

44
CREATE TABLE bands (
5-
id INT NOT NULL AUTO_INCREMENT,
6-
name VARCHAR(255) NOT NULL,
5+
id INT NOT NULL AUTO_INCREMENT,
6+
name VARCHAR(255) NOT NULL,
77
PRIMARY KEY (id)
88
);
99

1010
CREATE TABLE albums (
11-
id INT NOT NULL AUTO_INCREMENT,
11+
id INT NOT NULL AUTO_INCREMENT,
1212
name VARCHAR(255) NOT NULL,
1313
release_year INT,
1414
band_id INT NOT NULL,

solutions/1.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CREATE TABLE songs (
2-
id INT NOT NULL AUTO_INCREMENT,
2+
id INT NOT NULL AUTO_INCREMENT,
33
name VARCHAR(255) NOT NULL,
44
length FLOAT NOT NULL,
55
album_id INT NOT NULL,

solutions/10.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
SELECT AVG(length) as 'Average Song Length'
1+
SELECT AVG(length) as 'Average Song Duration'
22
FROM songs;

solutions/11.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
SELECT
2-
albums.name AS 'Album',
2+
albums.name AS 'Album',
33
albums.release_year AS 'Release Year',
44
MAX(songs.length) AS 'Duration'
55
FROM albums

solutions/12.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
SELECT
2-
bands.name AS 'Band',
2+
bands.name AS 'Band',
33
COUNT(songs.id) AS 'Number of Songs'
44
FROM bands
55
JOIN albums ON bands.id = albums.band_id

solutions/4.sql

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
2+
/* This assummes all bands have a unique name */
13
SELECT DISTINCT bands.name AS 'Band Name'
24
FROM bands
3-
JOIN albums ON bands.id = albums.band_id;
5+
JOIN albums ON bands.id = albums.band_id;
6+
7+
/* If bands do not have a unique name then use this query */
8+
/*
9+
SELECT bands.name AS 'Band Name'
10+
FROM bands
11+
JOIN albums ON bands.id = albums.band_id
12+
GROUP BY albums.band_id
13+
HAVING COUNT(albums.id) > 0;
14+
*/

solutions/5.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SELECT DISTINCT bands.name AS 'Band Name'
1+
SELECT bands.name AS 'Band Name'
22
FROM bands
33
LEFT JOIN albums ON bands.id = albums.band_id
44
GROUP BY albums.band_id

solutions/6.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
SELECT
2-
albums.name as Name,
2+
albums.name as Name,
33
albums.release_year as 'Release Year',
44
SUM(songs.length) as 'Duration'
55
FROM albums

solutions/7.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/* This is the query used to get the id */
2-
/* SELECT * FROM albums where release_year IS NULL; */
2+
/*
3+
SELECT * FROM albums where release_year IS NULL;
4+
*/
35

46
UPDATE albums
57
SET release_year = 1986

solutions/8.sql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ INSERT INTO bands (name)
22
VALUES ('Favorite Band Name');
33

44
/* This is the query used to get the band id of the band just added */
5-
/* SELECT id FROM bands
6-
ORDER BY id DESC LIMIT 1; */
5+
/*
6+
SELECT id FROM bands
7+
ORDER BY id DESC LIMIT 1;
8+
*/
79

810
INSERT INTO albums (name, release_year, band_id)
911
VALUES ('Favorite Album Name', 2000, 8);

solutions/9.sql

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
/* This is the query used to get the album id of the album added in #8 */
2-
/* SELECT id FROM albums
3-
ORDER BY id DESC LIMIT 1; */
2+
/*
3+
SELECT id FROM albums
4+
ORDER BY id DESC LIMIT 1;
5+
*/
46

57
DELETE FROM albums
68
WHERE id = 19;
79

810
/* This is the query used to get the band id of the band added in #8 */
9-
/* SELECT id FROM bands
10-
ORDER BY id DESC LIMIT 1; */
11+
/*
12+
SELECT id FROM bands
13+
ORDER BY id DESC LIMIT 1;
14+
*/
1115

1216
DELETE FROM bands
1317
WHERE id = 8;

0 commit comments

Comments
 (0)