insert into sailors values (99, 'Frank', NULL, 23)

select * from sailors

select * 
from sailors 
where rating < 5

select * 
from sailors 
where rating < 5 or rating IS NULL

select * 
from sailors 
where (rating = 5) or not (rating = 5)

select b1.bid, b1.bname, b1.color
from boats b1, boats b2
where b1.bid = b2.bid and b1.bname = b2.bname and b1.color = b2.color

select s1.sid, s1.sname, s1.rating, s1.age
from sailors s1, sailors s2
where s1.sid = s2.sid and s1.sname = s2.sname and s1.rating = s2.rating
        and s1.age = s2.age

select count (rating) from sailors

select s.rating, min (s.age)
from sailors s
group by s.rating

insert into sailors values (98, 'Fred', NULL, 25)

select s.rating, min (s.age)
from sailors s
group by s.rating
order by s.rating desc

select s.rating, min (s.age) as minage
from sailors s
group by s.rating
order by minage

insert into reserves values (99, 104, '10-JAN-99')

/* reservations for sailors not known to be rated 10 */
select * 
from reserves R
where R.sid NOT IN (select S.sid 
                    from sailors S
                    where S.rating = 10)

/* reservations for sailors not known to be rated 10 */
select * 
from reserves R
where NOT EXISTS (select * 
                  from sailors S
                  where S.sid = R.sid and S.rating = 10)

/* reservations for sailors known not to be rated 10 */
select * 
from reserves R
where R.sid IN (select S.sid 
                    from sailors S
                    where S.rating <> 10)


