Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A. Find the names of all students who are friends with someone named Homer J. Simpson. B. For every pair of students who both like

image text in transcribed
A. Find the names of all students who are friends with someone named Homer J. Simpson.
B. For every pair of students who both like each other, return the name and status of both students.
C. Find all students who do not appear in the Likes table (as a student who likes or is liked) and
return their names and status. Sort by status, then by name within each status.
D. For every situation where student A likes student B,but we have no information about whom B
likes (that is, B does not appear as an ID1 in the Likes table),return A and B's names and status.
E. For each student A who likes student B where the two are not friends,but student B likes a
different student C,For all such trios, return the name and grade of A, B, and C.
F. Find the name and status of all students who are liked by more than one other student.
G. What is the average number of friends per student? (Your result should be just one number.)
H. Find the number of students who are either friends with Tom or are friends of Tom. Do not count
Tom, even though technically he is a friend of a friend.
I. Find the name and status of the student(s) with the greatest number of friends.
For the following relation schema: Students(ID, name, status) Grade History(IDcourselD, courseCredit, grade_point) Friend(ID1,102) Likes(ID1, ID2) Friend table represents unidirectional relationships ie if id 1 = 1510 and id2 = 1381 means 1510 friends with 1381 but not vice versa. Likes table represents unidirectional relationships ie if id 1 = 1689 and id2 = 1709 means 1689 Likes 1709 but not vice versa. The four years of undergraduate education are called: freshman, sophomore, junior, Senior Students Friend Likes Grade History ID name 1025 Rick 1101 Jerry 1247 Shaggy Rogers 1304 Winnie the Pooh 1316 Leonardo 1381 Charlie Brown and Snoopy 1468 Mickey Mouse 1501 Raphael 1510 Bugs Bunny 1641 Scooby-Doo 1661 Scrooge McDuck 1689 HomerJ. Simpson 1709 Tom 1782 DouTOP 1911 Homer Simpson 1934 Morty 1315/ 1641 ID1 ID2 101 102 1510 1381 1689 1709 1510 1689 1689 1709 1709 1689 1381 1247 1782 1709 1709 1247 1911 1247 1689 1782 1247 1468 1782 1468 1782 1468 1782 1304 1316 1304 1468 1101 1501 1934 1468 1641 1934 1501 1101 1641 1247 1101 1247 1501 1911 1501 1501 1934 1316 1934 1934 1304 1304 1661 1661 coursell courseCredit grade point year semester 1125 CSEM 000 2:20 FALL 125 CSE311 3 300 220 FALL 34 CSE3111 0.00 2:20 FALL 134 CSEIL 3 300 2120 FALL 2016 CSEL 0.00 21:20 FALL 015 CSENTL 3 400 2120 FALL 1458 CSERTL 000 220 FALL 458 CSEL 3 3.30 2020 FALL 1501 CSESTIL 0.00 220 FALL 1501 CSE TIL 271 2020 FALL 1541 CSE3116 0.00 2420 FALL 1541 CSERE 3 179 2020 FALL 1911/ 1025 1025 Write an expression in SQL for each of the following queries

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

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions

Question

How would you spend your last day on earth?

Answered: 1 week ago