-- backslash-c flight -- backslash-d -- backslash-d flights -- backslash-d airports -- backslash-d carriers -- my numbers got a little off --1 select count(*) from flights; --2 select * from flights order by departuredelay desc; --3 select * from flights where date='1-3-2008'; --4 select count(*) from flights where date_part('month',date)=3 and destination='PHL'; --4a select count(*) from flights where date_part('day', date)=5 and origin='PHL'; --4b select count(*) from flights where date_part('day', date)=5 and origin='PHL' and extract(hour from departuretime)=10; --5 select distinct departuredelay from flights order by departuredelay; --6 select count(distinct departuredelay) from flights ; --7 select max(distinct departuredelay) from flights ; select distinct departuredelay from flights order by departuredelay desc limit 1; --8 select * from flights order by departuredelay desc limit 1; select * from flights where departuredelay=(select max(departuredelay) from flights); with minn(ddmin) as (select max(departuredelay) from flights) select * from flights,minn where departuredelay=minn.ddmin; --9 select min(arrivaldelay) from flights where arrivaldelay>0; --10 select count(*) from flights where arrivaldelay=1; --11 select flightnum,count(flightnum) from flights where arrivaldelay=1 group by flightnum; --12 select count(distinct origin) from flights; select count(distinct destination) from flights; --13 select count(*) from carriers; select count(distinct carrier) from flights; --14 select count(distinct carrier) from flights where destination='PHL'; --15 select count(*) from flights where departuretime>arrivaltime; --18 select origin, count(*) from flights where departuretime>arrivaltime and destination = 'PHL' group by origin;