1. 插入数据
插入单个元组:
insert
into Student (Sno, Sname, Ssex, Sdept, Sage )
values ('95020', '陈东', '男', 'IS', 18);
插入一条记录(完整的):
insert
into Student
values ('95020', …… , 18, 'CS'); //按顺序
插入子查询结果:
select 子句目标列必须与 into 子句匹配
insert
into Deptage (Sdept, Avgage)
select Sdept, AVG (Sage)
from Student
group by ;
2. 修改数据
① update Student ③ update SC
set sage = 22 set Grade = 0
where Sno = '95001'; where 'CS' = ( select Sdept
from Student
② update Student where Student.Sno = SC.Sno );
set sage = sage + 1;
3. 删除数据
① delete ③ delete
from Student from SC
where Sno = '95019'; where 'CS' = ( select sdept
from Student
② delete where Student.Sno = SC.Sno );
from SC //删除所有的学生选课记录