首先创建两张表并添加数据
create table emp(
empno int(4) primary key,
ename varchar(10),
job varchar(9),
mgr int(4),
hiredate date,
sal decimal(7,2),
comm decimal(7,2),
deptno int(2)
);
insert into emp values
(7369,'Smith','clerk',7902,'1980-12-17',800,null,20),
(7499,'Allen','salesman',7698,'1981-02-20',1600,300,30),
(7521,'Ward','salesman',7698,'1981-02-22',1250,500,30),
(7566,'Jones','manager',7839,'1981-04-02',2975,null,20),
(7654,'Maritn','salesman',7698,'1981-09-28',1250,1400,30),
(7698,'Blake','manager',7839,'1981-05-01',2850,null,30),
(7782,'Clark','manager',7839