p79-p85
#1.【例5.1】向student1表插入一条记录('196001','董明霞','女','1999-05-02','通信’,50)
use stusys;
create table student1 like student;
insert into student1
values ('196001','董明霞','女','1999-05-02','通信','50');
select * from student1;
#2.【例5.2】向student1表插入一条记录,学号为“196002”,姓名为“李茜”,专业为“通信”,总学分48,性别为“女”,出生日期为“1998-07-25”
use stusys;
insert into student1 (sno,sname,specially,tc,ssex,birthday)
values('196002','李茜','通信',48,'女','1998-07-25');
select * from student1;
#3.【例5.3】向student1表插入一条记录,学号为“196004”,姓名为“周俊文”,性别为“男”、取默认值,出生日期为“1998-03-10”,专业为空值,总学分为52
use stusys;
insert into student1(sno,sname,ssex,birthday,specially,tc)
values('196004','周俊文','男','1998-03-10',null,52);
select * from student1;
#4.【例5.4】向student1表插入样本数据,共6条记录
insert ignore into student1
select * from student;
select * from student1;
#5.【例5.5】对student1表,重新插入记录('196002','李茜','女','1998-07-25','通信’,48)
use stusys;
replace into student1
values('196002','李茜','女','1998-07-25','通信','48');
#6.【例5.6】向student2表插入student表的记录
create table student2 like student;
insert into student2
select * from student;
select * from student2;
#7.【例5.7】在student1表中,将学生周俊文的出生日期改为“1999-03-10”
use stusys;
set sql_safe_updates=0;
update student1
set birthday='1999-03-10'
where sname='周俊文';
select * from student1;
#8. 【例5.8】在student1表中,将所有学生的学分增加2分
use stusys;
update student1
set tc=tc+2;
select * from student1;
#9. 【例5.9】在student1表中,删除学号为196004的行
use stusys;
delete from student1
where sno='196004';
select * from student1;
#10.【例5.10】在student1表中,删除所有行
delete from student1;
select * from student1;
#11.【例5.11】在student2表中,删除所有行
delete from student2;
select * from student2;