Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


another syntax like this

create table sailors(
sid int not null,
sname char(20) not null,
rating int,
age decimal,
constraint pk_sailors primary key(sid)
create table boats(
bid int not null,
bname char(10) not null,
color char(10) not null,
constraint pk_boats primary key(bid)
create table reserves(
sid int not null,
bid int not null,
reserveDate datetime not null,
constraint fk_reservesSid foreign key(sid) references sailors(sid),
constraint fk_reservesBid foreign key(bid) references boats(bid),

insert into sailors(sid,sname,rating,age) values('22','Dustin','7','45.0')
insert into sailors(sid,sname,rating,age) values('29','Brutus','1','33.0')
insert into sailors(sid,sname,rating,age) values('31','Lubber','8','55.5')
insert into sailors(sid,sname,rating,age) values('32','Andy','8','25.5')
insert into sailors(sid,sname,rating,age) values('58','Rudy','10','35.0')
insert into sailors(sid,sname,rating,age) values('64','Horatio','7','35.0')
insert into sailors(sid,sname,rating,age) values('71','Zorba','10','16.0')
insert into sailors(sid,sname,rating,age) values('74','Horatio','9','25.5')
insert into sailors(sid,sname,rating,age) values('85','Art','3','63.5')
insert into sailors(sid,sname,rating,age) values('95','Bob','3','35.0')

insert into boats(bid,bname,color) values('101','Interlake','blue')
insert into boats(bid,bname,color) values('102','Interlake','red')
insert into boats(bid,bname,color) values('103','Clipper','green')
insert into boats(bid,bname,color) values('104','Marine','red')

insert into reserves(sid,bid,reserveDate) values('22','101','10/10/08')
insert into reserves(sid,bid,reserveDate) values('22','102','10/10/08')
insert into reserves(sid,bid,reserveDate) values('22','103','10/08/08')
insert into reserves(sid,bid,reserveDate) values('22','104','10/07/08')
insert into reserves(sid,bid,reserveDate) values('31','102','11/10/08')
insert into reserves(sid,bid,reserveDate) values('31','103','11/06/08')
insert into reserves(sid,bid,reserveDate) values('31','104','11/12/08')
insert into reserves(sid,bid,reserveDate) values('64','101','09/05/08')
insert into reserves(sid,bid,reserveDate) values('64','102','09/08/08')
insert into reserves(sid,bid,reserveDate) values('74','103','09/08/08')

select * from boats
select * from sailors
select * from reserves

[color=Blue]select dbo.sailors.sid, dbo.sailors.sname, count( as banyak from inner join
dbo.reserves on = inner join dbo.sailors on dbo.reserves.sid = dbo.sailors.sid
group by dbo.sailors.sid, dbo.sailors.sname
having (count(>1)[/color]

drop table boats
drop table reserves
drop table sailors

Can you help me to make another syntax from syntax that mark on blue color?
I think that syntax is so difficult.can you make another simple syntax plz.

Sign In or Register to comment.