Queries for art course

Solution

— 1)

select c.Course, c.CourseDate, c.Fee, e.CustomerNumber, e.AmountPaid

from COURSE as c, ENROLLMENT as e

where c.Course = ‘Adv. Pastels’ and c.CourseNumber = e.CourseNumber;

— 2)

select min(AmountPaid), max(AmountPaid), avg(AmountPaid)

from ENROLLMENT;

— 3)

select CustomerNumber, sum(AmountPaid)

from ENROLLMENT

group by CustomerNumber;

— 4)

select CustomerName from CUSTOMER

where CustomerName like ‘%son’

order by CustomerName desc;

— 5)

select e.CourseNumber, e.CustomerNumber, c.Fee – sum(e.AmountPaid)

from ENROLLMENT as e, COURSE as c

where e.CourseNumber = c.CourseNumber

group by e.CustomerNumber

having sum(e.AmountPaid) < c.fee;