--将元组(学号:201215128 :姓名:陈东, 性别男 ,所在系IS,年龄18岁) 插入学生表中
select * from student;
insert into student(sno,sname,ssex,sage,sdept)
values('201215128','陈东','男','18','IS');
insert into student values('201215128','陈东','男','18','IS');
--插入一条选课记录('201215128','1')
insert into sc (sno,cno)
values('201215128','1');
insert into sc values('201215128','1',null);
--对每一个系求学生的平均年龄,并将结果存入数据库
--方法1 先创建表,插入子查询结果
create table tavg (
sdept char(20),
avg_age int );
insert into tavg (sdept,avg_age)
select sdept,avg(sage) pjnl from student group by sdept;
--方法2 简写形式
create table tavg as
select sdept,avg(sage) pjnl from student group by sdept;
select * from tavg;
drop table tavg;
数据插入--将元组(学号:201215128 :姓名:陈东, 性别男 ,所在系IS,年龄18岁) 插入学生表中select * from student;insert into student(sno,sname,ssex,sage,sdept) values('201215128','陈东','男','18','IS');insert into student values('2...