Skip to content

Instantly share code, notes, and snippets.

@epok07
Created February 3, 2013 02:22
Show Gist options
  • Save epok07/4700304 to your computer and use it in GitHub Desktop.
Save epok07/4700304 to your computer and use it in GitHub Desktop.
To the Question: List the "Name" and "Salary" of the Profs who teach more than
SELECT
professors.`name`,
SUM(profs.professors.`salary`) AS salary #, count(profs.students.`name`) as "student count"
FROM
professors,
students
CROSS JOIN courses
WHERE
professors.`name` = prof_name
AND students.`name` = stud_name
GROUP BY
professors. NAME #having salary > 20000 #// avg salary( 10000 ) * 20
HAVING
count(profs.students.`name`) > 20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment