ask:how to make syntax's code from this question - Programmers Heaven

Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

ask:how to make syntax's code from this question

mepalmepal Posts: 7Member
table sailors
=============

sid sname rating age
--------------------------------------
22 Dustin 1 45
29 Brutus 1 33
31 Lubber 8 55,5
32 Andy 8 25,5
58 Rusty 10 35
64 Hiratio 7 35
71 Zorba 10 16
85 Art 3 25,5
95 Bob 3 63,5
74 Horatio 9 35

table Reserves
==============

sid bid day
-----------------------
22 101 10/10/08
22 102 10/10/08
22 103 10/08/08
22 104 10/07/08
31 102 11/10/08
31 103 11/06/08
31 104 11/12/08
64 101 09/05/08
64 102 09/08/08
74 103 09/08/08


table boat
==========

bid bname color
-----------------------------
101 Interlake Blue
102 Interlake red
103 Chipper green
104 Marine red


*********************************


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,
tgl 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,tgl) values('22','101','10/10/08')
insert into reserves(sid,bid,tgl) values('22','102','10/10/08')
insert into reserves(sid,bid,tgl) values('22','103','10/08/08')
insert into reserves(sid,bid,tgl) values('22','104','10/07/08')
insert into reserves(sid,bid,tgl) values('31','102','11/10/08')
insert into reserves(sid,bid,tgl) values('31','103','11/06/08')
insert into reserves(sid,bid,tgl) values('31','104','11/12/08')
insert into reserves(sid,bid,tgl) values('64','101','09/05/08')
insert into reserves(sid,bid,tgl) values('64','102','09/08/08')
insert into reserves(sid,bid,tgl) values('74','103','09/08/08')


how to make syntax from question below?

1.find sailor's names that have reserve boat 103
2.find sailor's names that have reserve red boat
3.find sailor's names that have reserve atleast 2 boat
4.find names and ages of sailors which rating >7
5.find sailor's names that have reserve all the red boat

thanks
Sign In or Register to comment.