一道sql 关于union得问题

来源:百度知道 编辑:UC知道 时间:2024/05/06 06:02:08
create table department (
DeptNo smallint not null,
DeptName char(40) not null,
Manager smallint not null,
primary key ( DeptNo ));

create table workson (
ProjectNo smallint not null,
EmployeeNo smallint not null,
primary key (ProjectNo, EmployeeNo));

create table employee (
EmpNo smallint not null,
LastName char(20) not null,
FirstName char(20) not null,
PhoneExt smallint not null,
Salary decimal(10,2) not null,
DeptNo smallint not null,
MgrNo smallint,
primary key ( EmpNo ));

create table projects (
ProjectNo smallint not null,
ProjectName char(255) not null,
ProjectManager smallint not null,
primary key ( ProjectNo ));
这是4个表

Give the Employee number of every employee who manages or works on a project (involves a UNION). 这是问题~~
怎么想也没思路 那位老师帮帮我~~

我对你那个问题的翻译是:
给出每个管理或者参加了项目的员工的员工编号(包含一个union)
select distinct ProjectManager from projects
union
select distinct EmployeeNo from workson

dapartment
DeptNo DeptName Manager

workson
ProjectNo EmployeeNo

employee
EmpNo LastName FirstName PhoneExt Salary DeptNo MgrNo

projects
ProjectNo ProjectName ProjectManager

没有交代清楚每个东西的意思啊,比如 MgrNo 什么意思啊 ??
还有ProjectManager 存的名字还是编号啊 ???
具体一点啊

都不知道你要做什么东西。