SQL Query
1)Show the name of the customer who has an invoice (i.e.
customer who made a purchase). The name should not duplicate.
(b) Count the number of customers who do not have an invoice.
(i.e. customer who did not make a purchase).
3. Generate a listing of the Invoice Amount for each invoice.
Sort the output by the CUS_CODE in ascending then the invoice
amount in descending order.
4. Use a query to compute the average purchase value per unit
made by each customer. The output should also show the customers
with no purchase. A partial example output is shown below. Submit
the SQL and the result table.
5. List the vendor code, name of the vendor, number of product
and the total holding inventory value that will supply the holding
inventory. The total holding inventory value is the sum of
P_QOH*P_PRICE of the products. Sort the output by the V_CODE in
ascending order. P_QOH= Product Quantity on holding. A sample
output is shown below. Submit the SQL and the result table.
6. (a) Explain how a natural join works and illustrate with an
example using the tables from the SaleCo7 database. (b) If you use
the tables given in Question 1 to construct a natural join between
the table TA and the table TB will it produce an inner join
outcome? Explain your answer. (c) How would you change a table in
Question 1 such that a natural join between the tables will produce
the following outcome. Submit the SQL and the join tables.
7. You are given the following two tables T1 and T2. Use the
tables to provide your answers. You need to submit the SQL for (b)
and (c).
(a) Explain the differences between an inner join and an outer
join. (b) Write the SQL with an inner join to find the guests in T2
who are also in T1. (c) Write the SQL with an outer join to count
the number of guests in T2 who are not in T1.
SQL Query 1)Show the name of the customer who has an invoice (i.e. customer who made a purchase). The name should not du
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
SQL Query 1)Show the name of the customer who has an invoice (i.e. customer who made a purchase). The name should not du
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!