Skip to content

Instantly share code, notes, and snippets.

@saqibmehmoodgit
Created September 13, 2022 07:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saqibmehmoodgit/699f1971d56e6d5aa370aa9533e99866 to your computer and use it in GitHub Desktop.
Save saqibmehmoodgit/699f1971d56e6d5aa370aa9533e99866 to your computer and use it in GitHub Desktop.
table student
bookid authorid
1 1
1 2
2 2
select s.bookid from student s
group by s.bookid
having count(s.authorid) =1
Explaination :::: As we know that "group by" is executed before "having" so first line number 8 will be executed
and there will be 2 groups (1 and 2) and than having will be executed so how the answer will be 2 only .
Can any body tell that if there is having after group by so they will be executed same time ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment