SQL not a group expression. find instructors who teach every course in his/her department
<pre><code>select instructor.name, instructor.id
from instructor,teaches,course
where instructor.id = teaches.ID and course.course_id = teaches.course_id
and instructor.dept_name = course.Dept_name
group by instructor.name
</code></pre>

<p>I am new to sql and nested queries. I am trying to find the instructor name and id, who teaches every course in his or her department.</p>

<p>This is what I have so far. I want to use group by to count the courses they teach and compare to all the courses under that department. but I stuck here, it says SQL Error: ORA-00979: not a GROUP BY expression</p>

<p>I don't know how to proceed with this. </p>

<pre><code>teaches(ID, course id, sec id, semester, year)
course(course id, title, dept name, credits)
instructor(ID, name, dept name, salary)
</code></pre>

<p>I am so confused about aggregate functions, and how is a valid group by expression. Can anyone help me? </p>