In the following exercises, you will use the data in the Premiere Product databa
ID: 3704049 • Letter: I
Question
In the following exercises, you will use the data in the Premiere Product database. In each step, use SQL to obtain the desired results.
1.list the number and name of very customer represented by sales rep 20.
2.for each order, list the order number, order date, the number of the customer that placed the order, and the name of the customer that placed the order.
3.list the number and the name of all customers represented by Valerie. (first or last name)
4.how many customers have a credit limit of $7500?
5.find the total of the balances for all customers for each sales rep.
Explanation / Answer
Customer Table
Order
Rep
1.
select Customer_Name , Customer_Num
from Customer
where rep_num = 20 ;
Fetch customer name and number from customer table where rep is 20.
Considering rep_num of integer type
2.
select Order_Num , Order_Date , Order.Customer_Num , Customer.Customer_Name
from Customer , Order
where Order.Customer_Num = Customer.Customer_Num ;
We need join of these 2 tables as we have to fetch customer name from customer table.
3.
select Customer_Name , Customer_Num
from Customer , Rep
where (Customer.rep_num = Rep.rep_num) and ( Rep.First_Name = 'Valerie' or Rep.Last_Name = 'Valerie') ;
Fetch customer name and number where both condition of 'where' clause is met.
4.
select count(Customer_Num)
from Customer
where credit_limit = 7500 ;
We count number of customers having credit_limit of 7500
Customer_Num Customer_Name street city state zip_balance credit_limit rep_numRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.