34,594
社区成员
发帖
与我相关
我的任务
分享
create table studentValue
(
学号 varchar(10),
姓名 varchar(10),
品德考核分值 tinyint,
学习考核分值 tinyint,
体育考核分值 tinyint,
总考核分值 tinyint
)
insert studentValue select '001','王波',0,0,0,90
insert studentValue select '002','张三',0,0,0,82
insert studentValue select '003','李四',0,0,0,76
update studentValue set 品德考核分值=round(总考核分值*0.3,0),学习考核分值=round(总考核分值*0.5,0), 体育考核分值=round(总考核分值*0.2,0)
select * from studentValue
学号 姓名 品德考核分值 学习考核分值 体育考核分值 总考核分值
---------- ---------- ------ ------ ------ -----
001 王波 27 45 18 90
002 张三 25 41 16 82
003 李四 23 38 15 76
(3 行受影响)
应该这样才准确.
update studentValue set 品德考核分值=总考核分值*0.3,学习成绩考核分值=总考核分值*0.5, 体育考核分值=总考核分值*0.2
create table studentValue
(
学号 varchar(10),
姓名 varchar(10),
品德考核分值 tinyint,
学习考核分值 tinyint,
体育考核分值 tinyint,
总考核分值 tinyint
)
insert studentValue select '001','王波',0,0,0,90
insert studentValue select '002','张三',0,0,0,82
insert studentValue select '003','李四',0,0,0,76
update studentValue set 品德考核分值=总考核分值*0.3,学习考核分值=总考核分值*0.5, 体育考核分值=总考核分值*0.2
select * from studentValue
学号 姓名 品德考核分值 学习考核分值 体育考核分值 总考核分值
---------- ---------- ------ ------ ------ -----
001 王波 27 45 18 90
002 张三 24 41 16 82
003 李四 22 38 15 76
(3 行受影响)
update studentValue set 品德考核分值=总考核分值*0.3,学习成绩考核分值=总考核分值*0.5, 体育考核分值=总考核分值*0.2