8. The following questions below ask you to check the syntax of SQL commands. Su
ID: 3733666 • Letter: 8
Question
8. The following questions below ask you to check the syntax of SQL commands. Suppose we Num, fName, IName, DOB, GPA, Major#, Dept#) FOREIGN KEY Dept# REFERENCES Department (Drum have the following relational schema. Student (S FOREIGN KEY Major# REFERENCES Major (Major#) Department (DNum. D Name, Building#) Major (Maior# MajorName, DegreeName, D Num) Find all the student names whose GPA is smaller than the average GPA of all the students. Fix the error(s) in the following SQL statement (that is, show the correct SQL statement that answers the query.) (2) a) SELECT S_NUM, fName, IName FROM Student WHERE GPAAVG (GPA) b) Find all the major numbers and major names that have fewer than 30 students.(3) SELECT Major, MajorName, COUNT(SNum) FROM Student S, Major M WHERES Major# : M. Maior# AND countS Num)Explanation / Answer
a). SELECT S_NUM,fName,lName from Student where GPA < ( SELECT AVG(GPA) from Student);
b). SELECT M.majorno,majorname,COUNT(S_NUM) FROM Student S , Major M where S.Majorno = M.Majorno GROUP BY Majorno Having COUNT(S_NUM) <30;
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.