Course1Module04ProblemSolutionsICA
Course1Module04ProblemSolutionsICA
The problems use the intercollegiate athletics database. The course website also contains
1. List the customer number, the name, the phone number, and the city of customers.
2. List the customer number, the name, the phone number, and the city of customers who
3. List all columns of the EventRequest table for events costing more than $4000. Order the
4. List the event number, the event date (DateHeld), and the estimated audience number with
approved status and audience greater than 9000 or with pending status and audience greater
than 7000.
5. List the event number, event date (DateHeld), customer number and customer name of
6. List the average number of resources used (NumberFld) by plan number. Include only
7. List the average number of resources used (NumberFld) by plan number. Only include
location number L100. Eliminate plans with less than two event lines containing location
number L100.
Solutions
All statements execute in both Oracle and PostgreSQL except where noted.
1.
SELECT CustNo, CustName, Phone, City
FROM Customer;
2.
8/15/2022 Module 4 Problem Solutions 2
3.
SELECT *
FROM EventRequest
WHERE EstCost > 4000
ORDER BY DateHeld;
4. The parentheses are necessary when mixing the logical AND and OR connectors.
5.
6.
SELECT PlanNo, AVG(NumberFld) AS AvgNumResources
FROM EventPlanLine
WHERE LocNo = 'L100'
GROUP BY PlanNo;
7.
SELECT PlanNo, AVG(NumberFld) AS AvgNumResources,
COUNT(*) AS NumEventLines
FROM EventPlanLine
WHERE LocNo = 'L100'
GROUP BY PlanNo
HAVING COUNT(*) > 1;