问题:如何在表中新增一列数据,该数据用来判断已存在列的数据情况,具体问题效果如下:(解决必采纳)
已知表:t_score
id subject score
1 JAVA 60
2 MYSQL 80
3 LINUX 55
4 PYTHON 50
5 HTML 70
编写一条sql,增加是否及格列,显式如下(及格分数为60):
id subject score mark
1 JAVA 60 ok
2 MYSQL 80 ok
3 LINUX 55 no
4 PYTHON 50 no
5 HTML 70 ok
建表代码如下
# 2.题目已知表:t_score
drop table if exists t_score;
create table if not exists t_score(
id int comment '学号',
`subject` varchar(10) comment '科目',
score int comment '成绩'
)engine = innodb default charset = utf8 comment '成绩表';
# 插入数据
insert into t_score values (1,'JAVA',60),(2,'MYSQL',80),(3,'LINUX',55),(4,'PYTHON',50),(5,'HTML',70);
# 查看表数据
select * from t_score;