SQL 建表
–建表
create table ADFN01 (UserID int ,
UserName varchar2(50) ,
UserSet int ,
Age int
);
–查表
select * from adfn01 ;
–增添数据
insert into adfn01 (userid,username,userset,age) values (1,‘张三’,0,25);
insert into adfn01 (userid,username,userset,age) values (2,‘李四’,1,18);
insert into adfn01 (userid,username,userset,age) values (3,‘王五’,0,21);
insert into adfn01 (userid,username,userset,age) values (4,‘赵虎’,0,19);
–删除字段
Alter table adfn01 drop column salary ;
– 新增字段
alter table adfn01 add salary number (6,2);–BINARY_DOUBLE
alter table adfn01 add reward BINARY_DOUBLE ;
case when
UPDATE adfn01 SET salary = case when age = 25 then salary +1 else salary end;
执行update语句,当age = 25 条件成立,执行then后面语句(salary + 1)否则执行else后面的(等于salary本身)。