时间:2021-07-01 10:21:17 帮助过:40人阅读
INSERT INTO `t_demo` VALUES (‘1‘, ‘张三‘, ‘21‘, ‘69‘); INSERT INTO `t_demo` VALUES (‘2‘, ‘李四‘, ‘22‘, ‘98‘); INSERT INTO `t_demo` VALUES (‘3‘, ‘王五‘, ‘20‘, ‘54‘); INSERT INTO `t_demo` VALUES (‘4‘, ‘赵甜‘, ‘22‘, ‘80‘);
SELECT *, CASE WHEN t.num >= 85 THEN ‘优秀‘ WHEN t.num < 90 AND t.num>= 60 THEN ‘一般‘ ELSE ‘不及格‘ END AS level FROM t_demo t;
查询结构:
MySQL case when 用法 详细举例,可创建数据演示
标签:dem attr csdn height case when case tle values int