Вы находитесь на странице: 1из 1

2. Select sname from sailors where rating > 8; 3.Select sailors.sname from sailors,reserves where sailors.sid = reserves.sid an d reserves.

bid=104; 4.Select sailors.sname from sailors,reserves,boats where sailors.sid = reserves. sid and boats.bid=reserves.bid and boats.color = 'brown'; 5.Select boats.color from boats,sailors,reserves where sailors.sid=reserves.sid and boats.bid=reserves.bid and sailors.sname='sam'; 6.Select distinct sailors.sname from sailors,reserves where sailors.sid=reserves .sid and reserves.dob IS NOT NULL; 7.Select sname from sailors where sname like 's%' and sname like '%s' and sname like '___%'; 8.Select sailors.sname from sailors,reserves,boats where sailors.sid = reserves. sid and boats.bid=reserves.bid and boats.color = 'brown' or boats.color='black'; 9.Select sailors.sname from sailors,reserves,boats where sailors.sid = reserves. sid and boats.bid=reserves.bid and boats.color <>'brown' or boats.color='black'; 10.Select sailors.sname from sailors,reserves,boats where sailors.sid = reserves .sid and boats.bid=reserves.bid and boats.color = 'brown' and boats.color='black '; 11.Select sailors.sid from sailors,reserves where sailors.rating =10 and sailors .sid = reserves.sid and reserves.bid = 101; 12.Select sailors.sname from sailors,reserves,boats where sailors.sid = reserves .sid and boats.bid=reserves.bid and boats.color <> 'black'; 13.Select sid,sname from sailors where rating > (Select rating from sailors wher e sname='Lobo'); 14.Select sid,sname from sailors where rating=(Select MAX(rating) from sailors); 15.Select sailors.sid,sailors.sname from sailors where NOT EXISTS(Select boats.b id from boats where NOT EXISTS(Select reserves.bid from reserves where reserves. bid=boats.bid and reserves.sid=sailors.sid)); 16.Select AVG(age) from sailors; 17.Select AVG(age) from sailors where rating = 10; 18.Select sname,age from sailors where age = (Select MAX(age) from sailors); 19.Select COUNT(sid) from sailors; 20.Select COUNT(distinct sname) from sailors; 21.Select sailors.sname from sailors where sailors.age > (Select MAX(sailors.age ) from sailors where sailors.rating=10); 22.Select sailors.rating, MIN(sailors.age) as Youngest_Sailors from sailors GROU P BY sailors.rating; 23.Select sailors.rating, MIN(sailors.age) as Youngest_Sailors from sailors wher e sailors.age >=18 GROUP BY sailors.rating HAVING COUNT(*)>1; 24.Select sailors.rating, AVG(sailors.age) as Avg_age from sailors GROUP BY sail ors.rating HAVING COUNT(*)>1; 25.