Skip to content

Instantly share code, notes, and snippets.

View Aneesh540's full-sized avatar
🏠
Working from home

Aneesh Jain Aneesh540

🏠
Working from home
View GitHub Profile
@backpackerhh
backpackerhh / core-set.sql
Last active March 18, 2024 17:24
SQL - Social-Network Query Exercises
-- 1. Find the names of all students who are friends with someone named Gabriel.
SELECT H1.name
FROM Highschooler H1
INNER JOIN Friend ON H1.ID = Friend.ID1
INNER JOIN Highschooler H2 ON H2.ID = Friend.ID2
WHERE H2.name = "Gabriel";
-- 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.