B
分组后再进行筛选
语法格式:
select
from
where
group by
having
代码:--删除工资表
drop table salary;
--删除员工表
drop table people;
--删除部门信息表
drop table dept;
--创建员工表
create table people(
id varchar2(12) not null primary key,
name varchar2(10)
);
--提交
commit;
--创建部门信息表
create table dept(
id varchar2(12) not null primary key,
pid varchar2(10),
foreign key(pid) references people(id),
name varchar2(10)
);
--提交
commit;
--创建工资表
create table salary(
spid varchar2(12),
sdid varchar2(12),
foreign key(spid) references people(id),
foreign key(sdid) references dept(id),
sal number(10)
);
--提交
commit;
--向员工表中插入数据
insert into people values('01','苏爱阳')
insert into people values('02','刘方园')
insert into people values('03','任米贺')
insert into people values('04','韩笑')
--提交插入的数据
commit;
--向部门信息表插入数据
insert into dept values('001','01','信息部')
insert into dept values('002','02','科技部')
insert into dept values('003','03','开发部')
insert into dept values('004','04','外交部')
--提交插入的数据
commit;
--向工资表中插入数据
insert into salary values('01','001',6000)
insert into salary values('02','002',5000)
insert into salary values('03','003',3000)
insert into salary values('04','004',6000)
--提交插入的数据
commit;