SQL数据库操作:学生表和成绩表实战练习
- SELECT department, COUNT(*) FROM student GROUP BY department;
- SELECT subject, MAX(score) FROM score GROUP BY subject;
- SELECT subject, score FROM score WHERE student_id = (SELECT id FROM student WHERE name = '李四');
- SELECT student.*, score.subject, score.score FROM student INNER JOIN score ON student.id = score.student_id;
- SELECT name, SUM(score) FROM student INNER JOIN score ON student.id = score.student_id GROUP BY name;
- SELECT subject, AVG(score) FROM score GROUP BY subject;
- SELECT student.* FROM student INNER JOIN score ON student.id = score.student_id WHERE score.subject = '计算机' AND score.score < 95;
- SELECT * FROM score WHERE subject = '计算机' ORDER BY score DESC;
- SELECT student.name, student.department, score.subject, score.score FROM student INNER JOIN score ON student.id = score.student_id WHERE student.name LIKE '张%' OR student.name LIKE '王%';
- SELECT student.name, student.age, student.department, score.subject, score.score FROM student INNER JOIN score ON student.id = score.student_id WHERE student.province = '湖南';
原文地址: https://www.cveoy.top/t/topic/ozE6 著作权归作者所有。请勿转载和采集!