需求说明
有3个表:
~学生表student(id, name, gender, age),
~课程表course(id, name, teacher),
~成绩表grade(s_id, c_id, score),
要求查出至少1门功课不及格的学生姓名、平均成绩。
测试数据
mysql> select * from student;
+----+------+--------+-----+
| id | name | gender | age |
+----+------+--------+-----+
| 1 | 小王 | 1 | 17 |
| 2 | 小花 | 0 | 18 |
| 3 | 小刘 | 1 | 16 |
| 4 | 小丽 | 0 | 19 |
+----+------+--------+-----+
mysql> select * from course;
+----+------+---------