Home > database >  The SQL query problem
The SQL query problem

Time:10-13

The student has the following two tables, score
1, check out each student's scores
2, the query out each class the highest and lowest points, as well as the corresponding student information
3, finds out the score of each class of the top ten and corresponding student information of

CodePudding user response:

1, check out each student's scores
The select A.s tu_id, A.s tu_name, B.s c_score
The from student A left join score on B (A.s tu_id=B.s tu_id);

2, the query out each class the highest and lowest points, as well as the corresponding student information
The select A.s tu_id, A.s tu_name, A.s tu_gender
The from student A left join score on B (A.s tu_id=B.s tu_id)
Group by stu_class having Max (B.s c_score), min (B.s c_score);

3, finds out the score of each class of the top ten and corresponding of student information
The select A.s tu_id, A.s tu_name, A.s tu_gender
The from student A left join score on B (A.s tu_id=B.s tu_id)
Group by stu_class order by B.s c_score desc limit 10;

I just learn SQL didn't take long, if there are any problems, please tell me, thank you
  • Related