这段文字的意思update student  set grade = (  select grade from  (  select id,  case when score> 90 then 'a'  when score > 80 then 'b'  when score > 70 then 'c'  else 'd' end grade  from student  ) a

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/22 10:12:58
这段文字的意思updatestudent  setgrade=(  selectgradefrom  (  selectid,  casewhenscore>90then''a''  whenscore>

这段文字的意思update student  set grade = (  select grade from  (  select id,  case when score> 90 then 'a'  when score > 80 then 'b'  when score > 70 then 'c'  else 'd' end grade  from student  ) a
这段文字的意思
update student
  set grade = (
  select grade from
  (
  select id,
  case when score> 90 then 'a'
  when score > 80 then 'b'
  when score > 70 then 'c'
  else 'd' end grade
  from student
  ) a
  where a.id = student.id
  );

这段文字的意思update student  set grade = (  select grade from  (  select id,  case when score> 90 then 'a'  when score > 80 then 'b'  when score > 70 then 'c'  else 'd' end grade  from student  ) a
只说这段代码希望达到的结果吧:根据student表里的各学生的score(分数)值设定grade字段的值(90分以上的为'a',80分以上的为'b',70分以上的'c',其他为'd')
不过感觉case那部分好像不太对,比如90分以上的会满足所有三个条件,那可能grade值应该会是'c'.