Question
Students at your hometown high school have decided to organize their social network using databases. So far, they have collected information about sixteen students in
Students at your hometown high school have decided to organize their social network using databases.
So far, they have collected information about sixteen students in four grades, 9-12. Here's the schema: Highschooler ( ID, name, grade ): there is a high school student with unique ID and a given first name in a certain grade. Friend ( ID1, ID2 ): the student with ID1 is friends with the student with ID2. Friendship is mutual, so if (123, 456) is in the Friend table, so is (456, 123). Likes ( ID1, ID2 ): the student with ID1 likes the student with ID2. Liking someone is not necessarily mutual, so if (123, 456) is in the Likes table, there is no guarantee that (456, 123) is also present.
Create SQL Queries to Find:
1. Find the names of all students who are friends with someone named Gabriel.
2. Find all students who do not appear in the Likes table (as a student who likes or is liked) and return their names and grades. 3. Find the name and grade of all students who are liked by more than one other student.
3. 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.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started