Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

wer the following business questions: (5 points). ng relation schema below to an

ID: 3827430 • Letter: W

Question

wer the following business questions: (5 points). ng relation schema below to answer following questions 2 points) credit (credit-number, branch name, balance, max credit) borrower credit-number) a" write an SQL statement to show all the customer names, credit balance are less than $500 away from the whose maximium credit line, that is max 500. b. Write a relational algera expression that will do exactly same asthe soL above. 2. Consider the following relational schema Wha Student (ID GPA) ID is a key Players (ID, sport) KID, sport is the primary key Where ID is student identification number in both schemas, sport is the name of the sport (like baseball, football etc.) Write a SQL query using aggregate functions to find out the average GPA for each sport. (3 points)

Explanation / Answer

credit(credit-number, branch-name, max_credit)
borrower(customer-name, credit-number)
a. Write an SQL statement to show all the customer names whose credit balance are less
than $500 away from the maximum credit line, that is (max_credit - balance) < 500

SELECT customer_name FROM credit C, borrower B WHERE
C.credit_number = B.credit_number AND max_credit - balance < 500
b. Write the relational algebra expression for the above question.

pi customer_name (row (max_credit - balance < 500)( C natural join B))

2. Student(ID, GPA)
Players(ID, sport)
Write a SQL query using aggregate functions to find out the average GPA for each sport.
SELECT sport, AVG(GPA) FROM Student S, Players P WHERE P.ID = S.ID GROUP BY sport