Conversation
| SELECT | ||
| name | ||
| FROM | ||
| student.student |
There was a problem hiding this comment.
This part looks fine, just wanted to comment that often in industry people would alias their tables here. E.g. "student.student s" would alias the table "s"
| FROM | ||
| student.student | ||
| JOIN | ||
| student.friend |
There was a problem hiding this comment.
This could be aliased too (for example f, or t2)
| JOIN | ||
| student.friend | ||
| ON | ||
| student.student.id = student.friend.id1 |
| FROM | ||
| student | ||
| AS | ||
| student1 |
There was a problem hiding this comment.
This is fine! Just a comment - It's okay to make short aliases, like s1, or s2, etc. to make typing easier.
| @@ -0,0 +1,16 @@ | |||
| INSERT INTO student VALUES (1510, 'Jordan', 9); | |||
There was a problem hiding this comment.
This is a workaround from loading the CSV file directly. Different database systems have different ways of doing this (copy, load data infile), but it'll be good for you to learn the methods because sometimes you'll end up having to work with big files, or you will be automating things and so you won't want to write the code by hand.
| ON | ||
| student.student.id = student.friend.id1 | ||
| WHERE | ||
| id2 = 1911 |
There was a problem hiding this comment.
The spirit of this task is to query everyone who is friends with someone named Gabriel, so you would probably want the where clause to be on the name. Hardcoding it for the two student IDs of people named Gabriel is manual (so it's actually more work), and your query doesn't reflect the spirit of the question, and it will break if there are any new people named Gabriel. Ideally, someone would be able to tell what you're trying to do by reading your query.
No description provided.