CREATETABLE score ( id INT COMMENT '编号', NAME VARCHAR ( 20 ) COMMENT '姓名', math INT COMMENT '数学', english INT COMMENT '英语', chinese INT COMMENT '语文' ) COMMENT '学员成绩表';
SELECT id, name, ( CASEWHEN math >=85THEN'优秀'WHEN math >=60THEN'及格'ELSE'不及格'END ) AS'数学成绩', ( CASEWHEN english >=85THEN'优秀'WHEN english >=60THEN'及格'ELSE'不及格'END ) AS'英语成绩', ( CASEWHEN chinese >=85THEN'优秀'WHEN chinese >=60THEN'及格'ELSE'不及格'END ) AS'语文成绩' FROM score;