One person chooses more than 2 failed courses SQL statements

Source: Internet
Author: User
(1) To inquire about two students who failed.
Ideas:
1. First use the WHERE clause in conjunction with the conditions of the score<60 to screen out all the failing persons and their failing courses
2. Use the GROUP BY clause to group by name and use the Count function to count the number of failed courses per person
3. Finally, the result of grouping aggregation is filtered by the HAVING clause, and the count statistic result equals 2 students.
Write it down, that's about it.
Select Student,count (*)
From table
where score<60
GROUP BY Student
Having Count (*) =2

(2) The average score of each course in each class is queried

Ideas:
are grouped by class and course, to change the average of class and course

Select Class, Course, AVG (score)
From table
Group BY class, course

One person chooses more than 2 failed courses SQL statements

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.