SQL Social-Network Query Exercises Solutions
SQL Social-Network Query Exercises
Pretty straightforward. Pay attention to the question.
Question 1
Find the names of all students who are friends with someone named Gabriel.
Select h1.name
From Highschooler h1,Highschooler h2,Friend
Where h1.ID = Friend.ID1
AND h2.name='Gabriel'
AND h2.ID = Friend.ID2
Question 2
For every student who likes someone 2 or more grades younger than themselves, return that student's name and grade, and the name and grade of the student they like.
Σχόλια