I need to write a SQL query which Displays the Name of the Courses which the students have an average greater than 55 in it
TABLES : STUDENTS,GRADES,COURSES,DEPARTMENTS
WHAT I DID :
SQL> SELECT COURSE_NAME
2 FROM COURSES
3 where
4 (select avg(grade)
5 from grades,courses
6 where
7 grades.course_id=courses.course_id)>55;
and the result is bad ! (It displays all the courses)
TABLES :
create table DEPARTMENTS
(
DEPARTMENT_ID char(2),
NAME varchar2(20),
HEAD varchar2(20));
create table COURSES
(
COURSE_ID char(10),
COURSE_NAME varchar2(20),
TYPE char(6),
POINTS number(2),
DEPARTMENT_ID char(2));
create table GRADES
(
STUDENT_ID number(3),
COURSE_ID char(10),
SEMESTER varchar2(10),
TERM char(1),
GRADE number(3),
GRADE_SEM number(3));
create table STUDENTS
(
STUDENT_ID number(3),
NAME char(15),
CITY char(15));