Write an SQL query that returns the studentid and name of the student(s) whose g
ID: 3596271 • Letter: W
Question
Write an SQL query that returns the studentid and name of the student(s) whose gpa is higher than the average gpa of all students.
book bookid title Introduction of Algorithms rice total copies 84.66 Database System Concepts74.99 Stochastic Calculus for Financ41.02 Stochastic Calculus for Finance II 55.22 course title Algorithms DB Organization Advanced DB Organization Math Finance I Math Finance II faculty enroll studentid courseid student studentid facultyid name gpa Tom 3.3 John3.8 Mary 3.0 Kris 3.6 Alex3.5 James 70000 Sarah 60000 ay 80000 Rache 70000 Pau85000 book_ checkout bookid studentid 2017-08-29 2017-09-02 2017-09-07Explanation / Answer
SELECT studenttid from student s where s.gpa > (SELECT AVG(gpa) from student)
(SELECT AVG(gpa) from student)--> this sub querey return average gpa of all student
in first query we are checking gpa of each student with average gpa of each student.
or we can write
SELET studentid from student s wehre s.gpa =(SELECT MAX(gpa) from student)
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.