1,社会团体(编号,名称,负责人,活动地点) society
参加(职工号,编号,参加日期)Join
职工(职工号) Employee
select 职工号
from Employee a
where a.职工号 in(select 职工号 from Join
where 编号 in(select 编号 from Join
where 职工号='1001'));
2,select (select 名称 from society where 编号=Join.编号) 社会团体名称,
sum(职工编号) 参加人数
from Join where 编号 =
(select bb.编号 from (select 编号,count(*) 数量 from Join group by 编号 ) bb
where bb.数量 =( select max(数量) from --得到最大数量
(select 编号,count(*) 数量 from Join
group by 编号 ) aa ) ); --根据最大数量得到团体编号
3,grant select, insert, delete on society to 李平 with grant option;
grant select, insert, delete on Join to 李平 with grant option;