2020-05-07

1.插入

–将一个新学生元组
insert into student(sno,sname,sage,sdept,ssex)
values(‘08013’,‘陈东’,‘18’,‘is’,‘男’);

insert into student(sno,sname)
values(‘08010’,‘唯一’);

insert into course
values(‘009’,‘数据结构’,‘4’,‘003’);

学生平均年龄表 表
create table Dept_age
(sdept char(15),Avg_age SMALLINT)
insert into Dept_age
select sdept,avg(sage)
from student
group by sdept;

– create table 表名 as 子查询;
CREATE table dept_age AS
select sdept,avg(sage) as avgage from student
group by sdept;
– 起别名

你可能感兴趣的:(笔记)