From ec7e6cc25092f092af01aabb439b5482a2dbfb5f Mon Sep 17 00:00:00 2001 From: pcrze68gk <3241302382@qq.com> Date: Thu, 11 Apr 2024 00:32:31 +0800 Subject: [PATCH] =?UTF-8?q?Add=20=E5=AE=9E=E9=AA=8C=E5=85=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 实验六 | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 实验六 diff --git a/实验六 b/实验六 new file mode 100644 index 0000000..49bbd88 --- /dev/null +++ b/实验六 @@ -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; \ No newline at end of file