Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The following questions refer to the Art Course database. You can obtain a copy

ID: 3853550 • Letter: T

Question

The following questions refer to the Art Course database. You can obtain a copy of this data in the Access 2010 database, located on Canvas the course Web site listed below under this assignment or you could simply download it by clicking the file name here Art_Course_Database.accdb).

The database contains data shown in Figure 1-10.

CUSTOMER (CustomerNumber, CustomerName, Phone)

COURSE (CourseNumber, Course, CourseDate, Fee)

ENROLLMENT (CustomerNumber, CourseNumber, AmountPaid)

where

CustomerNumber in ENROLLMENT must exist in CustomerNumber in CUSTOMER

CourseNumber in ENROLLMENT must exist in CourseNumber in COURSE

Write SQL queries to produce the following results:

1) List all occurrences of Adv. Pastels. Include all associated fields for each occurrence of the class.

2) List the minimum, maximum, and average full fee amount paid in the ENROLLMENT table.

3) List the total amount paid by each enrolled customer.

4) List the customer full name in one column whose last name ends with letters ‘son’. Sort the results by customer last name in descending order.

5) List the CustomerNumber and the amount due for those customers who haven’t paid in full for their courses yet.

Explanation / Answer

1) SELECT * FROM COURSE WHERE Course like Adv. Pastels;

This will retrieve the course information which is having the name like Adv. Pastels.

2) SELECT MIN(AmountPaid) as MinimumFeePaid,MAX(AmountPaid) as MaximumFeePaid,AVG(AmountPaid) as AverageFeePaid from ENROLLMENT;

The MIN,MAX and AVG functions will retrieve the Minimum,Maximum,Average values of the given column values.


3) SELECT SUM(AmountPaid) from ENROLLMENT;

The SUM function will retrieve the total value of summation of the given column.


4) SELECT CustomerName from CUSTOMER WHERE CustomerName LIKE '%SON' ORDER BY CustomerName DESC;

This will retrieve the customer name who is having the last name like son. Here %SON means in the place of % it can have any name but at last there must be SON. If something like that encounters in database it will retrieve those.

5) SELECT CustomerNumber, (FEE-AmountPaid) as DUE FROM COURSE,ENROLLMENT;

This retrieves the name and the due of the customers.