现有一张成绩表(result)如下:
| course_id | course_name | score |
|---|---|---|
| 1 | Java | 70 |
| 2 | Oracle | 90 |
| 3 | XML | 40 |
| 4 | JSP | 30 |
| 5 | Servlet | 80 |
为了便于阅读,请编写 SQL,使查询此表后的结果显示如下(及格分数为 60):
| course_id | course_name | score | mark |
|---|---|---|---|
| 1 | Java | 70 | pass |
| 2 | Oracle | 90 | pass |
| 3 | XML | 40 | fail |
| 4 | JSP | 30 | fail |
| 5 | Servlet | 80 | pass |
SELECT
course_id,
course_name,
score,
(CASE WHEN score >= 60 THEN 'pass' ELSE 'fail' END) AS mark
FROM
result;
友情提示: 题目来源于各家真实企业,以上回答仅供参考,不能确定是否符合出题人要考查的知识点!