Professional Documents
Culture Documents
Solutions For The Extra Problems in Module 4
Solutions For The Extra Problems in Module 4
The problems use the Order Entry Database as described in the Order Entry Database
Background document. The course website also contains Oracle and MySQL CREATE TABLE
1. List the customer number, the name (first and last), and the balance of customers.
2. List the customer number, the name (first and last), and the balance of customers who reside
3. List all columns of the Product table for products costing more than $50. Order the result
4. List the customer number, the name (first and last), the city, and the balance of customers
who reside in Denver with a balance greater than $150 or who reside in Seattle with a
5. List the order number, order date, customer number, and customer name (first and last) of
1. List the average balance of customers by city. Include only customers residing in
2. List the average balance and number of customers by city. Only include customers residing
in Washington State (WA). Eliminate cities in the result with less than two customers.
1.
SELECT CustNo, CustFirstName, CustLastName, CustBal
FROM Customer;
2.
SELECT CustNo, CustFirstName, CustLastName, CustBal
FROM Customer
2/3/2022 Solutions for the Extra Problems in Module 4 2
3.
SELECT *
FROM Product
WHERE ProdPrice > 50
ORDER BY ProdMfg, ProdName;
4. The parentheses are necessary when mixing the logical AND and OR connectors.
5.
Oracle solutions:
MySQL solution
6.
SELECT CustCity, AVG(CustBal) AS AvgBal
FROM Customer
WHERE CustState = 'WA'
GROUP BY CustCity;
7.
2/3/2022 Solutions for the Extra Problems in Module 4 3