Home > database >  MySQL small white, the great god help!
MySQL small white, the great god help!

Time:10-06


Student: table s student id name class number
Class table c: class # class class teacher
Curriculum k: class, class teacher
Result table g: class student id number grades
1) statistics each student's score, according to the results sorted in reverse chronological order
2) statistics for each class, each course grade average, according to the class, the result in reverse order
3) if students have duplicate data table, writing an article or group SQL delete duplicate data

CodePudding user response:

1,
 SELECT student id, 
The SUM (results) the AS scores
The result for the FROM
GROUP BY student number
The ORDER BY the SUM (grades) DESC;

CodePudding user response:

The
reference 1/f, February 16 response:
1,
 SELECT student id, 
The SUM (results) the AS scores
The result for the FROM
GROUP BY student number
The ORDER BY the SUM (grades) DESC;

There are three SQL statement! Which one is you? The second one?

CodePudding user response:

refer to the second floor shinymiao response:
Quote: reference 1/f, February 16 response:
1.
 SELECT student id, 
The SUM (results) the AS scores
The result for the FROM
GROUP BY student number
The ORDER BY the SUM (grades) DESC;

There are three SQL statement! Which one is you? The second one?

The first, not the 1

CodePudding user response:

Could you tell me how to write the other two SQL statements?
  • Related