parent
bf145d4889
commit
ec7e6cc250
@ -0,0 +1,48 @@
|
||||
use cs;
|
||||
|
||||
#查询表
|
||||
desc bmxx;
|
||||
desc spxx;
|
||||
desc supplier;
|
||||
desc ygxx;
|
||||
|
||||
#查看表内容
|
||||
select * from ygxx;
|
||||
select * from bmxx;
|
||||
select * from spxx;
|
||||
select * from spxx_bak;
|
||||
|
||||
#删除表中某个属性
|
||||
ALTER TABLE bmxx DROP COLUMN bmaddr;
|
||||
|
||||
#添加数据
|
||||
insert into ygxx(Ygbh,Name,Sex,Zw,Kl,QXjb,ssbmbh)values('10000001','张利','男','主管','123','5','1001');
|
||||
insert into ygxx(Ygbh,Name,Sex,Zw,Kl,QXjb,ssbmbh)values('10000002','刘程','男','副主管','123','4','1002');
|
||||
insert into ygxx values('10000003','张三','男','员工','12','1',null,'1003'),
|
||||
('10000004','李四','男','员工','12','1',null,'1004');
|
||||
insert into bmxx values('1001','业务'),('1002','技术'),('1003','售后'),('1004','管理');
|
||||
insert into spxx values('10000001','空调','电器','1500','10'),('10000002','书包','文具','100','20'),
|
||||
('10000003','卷纸','日用品','30','50'),('10000004','铅笔','文具','10','100'),
|
||||
('10000005','橡皮','文具','5','1000'),('10000006','风扇','电器','1000','10'),
|
||||
('10000007','水杯','日用品','20','100'),('10000008','牙刷','日用品','20','100');
|
||||
|
||||
#修改数据
|
||||
update spxx set Jg='95',sl='15'
|
||||
where Spmc='书包';
|
||||
update ygxx set Zw='主管'
|
||||
where Name='刘程';
|
||||
|
||||
SET SQL_SAFE_UPDATES = 0;
|
||||
|
||||
create table spxx_bak(
|
||||
Spbh char(8) not null primary key,
|
||||
Spmc varchar(20) not null,
|
||||
Sslb char(8) not null,
|
||||
Jg FLOAT(10,2) not null,
|
||||
sl int(4) not null);
|
||||
|
||||
#复制表内容
|
||||
insert into spxx_bak select * from spxx where Sslb='文具';
|
||||
|
||||
#删除表信息
|
||||
delete from spxx where Jg < 50;
|
||||
Loading…
Reference in new issue