Question about the query statement of "students who have selected all courses"

Source: Internet
Author: User
This is a post posted on the Forum. If no answer is answered, put it here first...

Select sname
From student
Where not exists
(Select *
From Course
Where not exists
(Select *
From SC
Where SC. Sno = student. SnO and SC. CNO = course. CNO );

In general, I know that not exists applies to all students who have not selected a course, but the program cannot understand it:
For example, the inmost query statement shows the course selection information of all students who have selected courses. Because all students here, it does not mean that all courses may be included, so does the next not exists nesting get a course that not all students have chosen?




Is there another way of writing? Is it feasible? "count (*) = count ([s #])" I don't understand what I got.

Select Sn, SD from S

Where [s #] In (

Select [s #] from SC

Right join

C On SC. [C #] = C. [C #] group by [s #]

Having count (*) = count ([s #])

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.