Permalink
Browse files

Tweaks from YouTube comment

  • Loading branch information...
1 parent bccb8e5 commit c7b3939806d615d088b3948370c30904e4120443 @csev committed Jan 4, 2017
Showing with 15 additions and 7 deletions.
  1. +15 −7 lectures3/Pythonlearn-15-Database-Handout.txt
@@ -65,11 +65,20 @@ INSERT INTO Track (title, rating, len, count, album_id, genre_id)
INSERT INTO Track (title, rating, len, count, album_id, genre_id)
VALUES ('Who Made Who', 5, 207, 0, 1, 2) ;
-SELECT Track.title, Genre.name FROM Track join Genre
+SELECT Album.title, Artist.name FROM Album JOIN Artist
+ ON Album.artist_id = Artist.id
+
+SELECT Album.title, Album.artist_id, Artist.id, Artist.name
+ FROM Album JOIN Artist ON Album.artist_id = Artist.id
+
+SELECT Track.title, Track.genre_id, Genre.id, Genre.name
+ FROM Track JOIN Genre
+
+SELECT Track.title, Genre.name FROM Track JOIN Genre
ON Track.genre_id = Genre.id
SELECT Track.title, Artist.name, Album.title, Genre.name
-FROM Track join Genre join Album join Artist
+FROM Track JOIN Genre JOIN Album JOIN Artist
ON Track.genre_id = Genre.id AND Track.album_id = Album.id
AND Album.artist_id = Artist.id
@@ -112,10 +121,9 @@ INSERT INTO Member (user_id, course_id, role) VALUES (2, 2, 1);
INSERT INTO Member (user_id, course_id, role) VALUES (2, 3, 1);
INSERT INTO Member (user_id, course_id, role) VALUES (3, 3, 0);
-ELECT User.name, Member.role, Course.title
-FROM User JOIN Member JOIN Course
-ON Member.user_id = User.id AND
-Member.course_id = Course.id
-ORDER BY Course.title, Member.role DESC, User.name
+SELECT User.name, Member.role, Course.title
+ FROM User JOIN Member JOIN Course
+ ON Member.user_id = User.id AND Member.course_id = Course.id
+ ORDER BY Course.title, Member.role DESC, User.name

0 comments on commit c7b3939

Please sign in to comment.