1. SELECT department, COUNT(*) FROM student GROUP BY department;
  2. SELECT subject, MAX(score) FROM score GROUP BY subject;
  3. SELECT subject, score FROM score WHERE student_id = (SELECT id FROM student WHERE name = '李四');
  4. SELECT student.*, score.subject, score.score FROM student INNER JOIN score ON student.id = score.student_id;
  5. SELECT name, SUM(score) FROM student INNER JOIN score ON student.id = score.student_id GROUP BY name;
  6. SELECT subject, AVG(score) FROM score GROUP BY subject;
  7. SELECT student.* FROM student INNER JOIN score ON student.id = score.student_id WHERE score.subject = '计算机' AND score.score < 95;
  8. SELECT * FROM score WHERE subject = '计算机' ORDER BY score DESC;
  9. 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 '王%';
  10. 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 = '湖南'
学生表: 成绩表: 向两个表中插入数据: 1 从student表中查询每个院系有多少人2 从score表中查询每个科目的最高分3 查询李四的考试科目和考试成绩4 查询所有学生的信息和考试信息5 计算每个学生的总成绩6 计算每个考试科目的平均成绩7 查询计算机成绩低于95的学生信息8 将计算机考试成绩按从高到低进行排序9 查询姓张或姓王的学生的姓名、院系和考试科目及成绩10 查询都是湖南的学生的姓名

原文地址: http://www.cveoy.top/t/topic/g0Sw 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录