--select * from courses --select * from courses c1 join courses c2 on c1.name = c2.name and c1.year = c2.year --and c1.crn < c2.crn --select name, year, count(*) as numtimes from courses --group by name, year --having count(*)>1 --select crn, count(*) as enrolled from grades group by crn --select crn, count(*), name from courses natural join grades group by crn, name --select * from (select crn, count(*) as enrolled from grades group by crn) natural join courses --WITH enrollment AS -- (select crn, count(*) as enrolled from grades group by crn), -- another_table AS -- (select ......) --select * from enrollment natural join courses --create view enrollment as (select crn, count(*) as enrolled from grades group by crn) --select * from enrollment --create table patron (cardnum int, pfirst varchar(100), plast varchar(100)); select * from patron --insert into patron(pfirst, plast) values ('Catie', 'Welsh') --update patron --SET pfirst='Phillip' --where plast='Kirlin' --delete from patron where cardnum is null