In SQL, create the query based on the model below: Retrieve the orders placed by
ID: 3874212 • Letter: I
Question
In SQL, create the query based on the model below:
Retrieve the orders placed by customer with ID 4 or 12, facilitated by salesperson with ID 2
or 6, after March 8, 2010 but before March 12, 2010. Output the order ID, order date,
customer ID, and salesperson ID. Sort in ascending order of customer ID, then in ascending
order of order date.
FIGURE 2-22 Data model for Pine Valley Furniture Company in Microsoft Visio notation SALESPERSON TERRITOR SIN PK Salesperson ID Serves PK Territory ID Salesperson Name Salesperson Telephone Salesperson Fax Territory Name CUSTOMER PRODUCT LINE PK Customer ID PK Product Line ID Customer Name Customer Address Customer Postal Code Product Line Name Submits Includes ORDER PK Order ID Order Date DUC ORDER LINE PK Product ID Product Description Product Finish Product Standard Price Ordered Quantity VENDOR USES PRODUCED IN PK Vendor ID Vendor Name Vendor Address Goes Into Quantity RAW MATERIAL WORK CENTER PK Material ID PK Work Center ID Material Name Material Standard Cost Unit Of Measure Work Center Location Supply Unit Price ls Supervised By EMPLOYEE WORKS IN SupervisesPEmployee ID HAS SKILL SKILL Employee Name Employee Address PK SkillExplanation / Answer
SELECT Order_ID, Order_Date,Customer_ID,SalesPerson_ID
FROM Customer, Order, SalesPerson
Where Order.Customer_ID = Customer.Customer_ID
AND Order.SalesPerson_ID= SalesPerson.SalesPerson_ID
AND (Customer_Id = 4 OR Customer_ID = 12)
AND (SalesPerson_ID = 2 OR SalesPerson_ID = 6)
AND (Order_Date < '12-MAR-2010' OR Order_Date > '08-MAR-2010');
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.