Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

More Books

Students also viewed these Databases questions

Question

What are three disadvantages of a civil service system?

Answered: 1 week ago

Question

What did they do? What did they say?

Answered: 1 week ago