sql基础语句
mysql workbench
create table s(`s#` int, `sname` char(8), `grade` int, primary key(`s#`)); #不知道为什么需要 ``, 居然因为是有了 #, 表示了注释,系统有点蒙
alter table s add address char(10); #这个就不需要``括起来了
alter table s drop address;
改正:
create table s(id_s char(10), name_s char(10), grade_s float, adress char(10),
primary key(id_s)
);
alter table s add age_s int;
alter table s drop adress;
insert into s(id_s, name_s, grade_s, age_s)
values ('001', 'xiaoming', 90, 18),
('002', 'xiaogang', 69, 17),
('003', 'xiaohua' , 85, 19),
('004', 'xiaomi' , 55, 19),
('005', 'xiaofa' , 65, 29);
select *
from s;
delete from s
where (grade_s < 60 or age_s < 12 or age_s > 20) and id_s != '000';
select *
from s
where id_s > 0;
update s
set grade_s = grade_s * 1.09 #, id_s = id_s
where grade_s < 60 and id_s != '0';
drop table s;