标签:
create table Emp
(
eid char(20) primary key,
ename char(20),
age integer check (age > 0),
did char(20),
salary float,
)
create table Dept
(
did char(20) primary key,
dname char(20),
mgr_did char(20),
)
alter table Emp add constraint fk_emp_did foreign key (did) references Dept(did)
alter table Dept add constraint fk_dept_mgrdid foreign key (mgr_did) references Emp(eid)
题目:写出一条SQL语句,查询工资高于10000,且与他所在部门的经理年龄相同的职工姓名。
select * from Emp a, Dept b, Emp c where a.did = b.did and b.mgr_did = c.eid and a.salary > 10000 and a.age = c.age;
题目:写出一条SQL语句,查询工资高于10000,且与他所在部门的经理年龄相同的职工姓名。
标签:
原文地址:http://www.cnblogs.com/sinodragon21/p/4353870.html