create table guest
(
Sid int identity primary key,
Sname varchar(200),
Gender varchar(1)
)
create table host
(
Uid int identity primary key,
Duty varchar(200)
)
create table doub
(
Did int identity primary key,
Sid int references guest(Sid),
Uid int references host(Uid)
)
select g.*,h.Duty from guest g inner join doub d on g.Sid=d.Sid inner join host h on h.Uid=d.Uid
select g.*,h.Duty from guest g,host h,doub d where g.Sid=d.Sid and h.Uid=d.Uid
select guest.*,(select host.Duty from host where host.Uid=doub.Uid) as Duty from guest,doub where guest.Sid=doub.Sid