Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write the SQL statements for below: 1. Display the customer ID, customer name and customer state in the table Customer_T if the customer has business

Write the SQL statements for below:

1.

  • Display the customer ID, customer name and customer state in the table Customer_T if the customer has business in the Central or NorthEast territories; 
  • Sort the result set by customer ID in ascending order.

  

2.

  •  For each product finish, calculate the number of products, the average standard price and the highest standard price;
  •  Display the product finish and the calculated data, if the product is NOT made with White Ash and the lowest standard price is above 100
  •  Sort the result set by the number of products in descending order.

     

3.

  • ·Display the territory ID, territory name, customer ID, customer name, salesperson ID and salesperson name, if the salesperson's phone number begins with 813 (note: the phone number is defined as CHAR(10).);
  • Sort the result set first by territory ID in ascending order and then by customer ID in descending order.

4.

  •   For each product line, calculate the number of products and the largest ordered quantity
  •   Display the product line ID, product line name, the calculated data if any product in the product line has been ordered by a customer living in in CA, NJ, FL or TX and the total ordered quantity is over 5
  •  Sort the result set by the number of products in descending order

1.PNG

3.PNG

2.PNG

Capture.PNG


 
 
 
 

2 PINE VALLEY FURNITURE COMPANY (SAMPLE DATA TABLES) Customer_T Customer_ID Customer_Name Customer_Address Customer_City Customer_State Postal Code 1 Contemporary Casuals 1355 S Hines Blvd Gainesville FL 2 Value Furniture TX NY 3 Home Furnishings 4 Eastern Furniture 5 Impressions 15145 S.W. 17th St. 1900 Allard Ave. 1925 Beltline Rd. 5585 Westcott Ct. NJ CA Order_T Order Date 1001 10/21/2008 12:00:00 AM 1010 11/5/2008 12:00:00 AM 1006 10/24/2008 12:00:00 AM 1005 10/24/2008 12:00:00 AM 1009 11/5/2008 12:00:00 AM Order ID Customer_ID 1 1 3 Plano Albany Carteret Sacramento 326012871 750947743 122091125 070083188 942064056 Order_Line_T Order ID Product_ID Ordered Quantity 1001 1001 1001 1002 1003 1 2 4 3 3 22753

Step by Step Solution

3.54 Rating (151 Votes )

There are 3 Steps involved in it

Step: 1

Based on the provided information and the relational schema here are the SQL statements for each of the described tasks 1 Display the customer ID customer name and customer state in the table Customer... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions