Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Compose an SQL statement that will find the sales persons that its customers and the orders they placed. Group them by Territory in Ascending order.

Compose an SQL statement that will find the sales persons that its customers and the orders they placed. Group them by Territory in Ascending order.

Table1:Salesperson_t

Salesperson_t
Salesperson_ID Salesperson_name Salesperson_telephone Salesperson_fax Territory_ID
1 Johnson 206-774-5589 206-774-5570 1
2 Haverty 541-443-8934 541-443-8900 1
3 Rodriguez 415-663-5454 415-664-7823 2
4 Chan 714-964-6296 714-885-3498 2
5 Swensen 612-338-9090 612-338-5409 3
6 Kotlowski 219-289-2641 219-653-4444 3
7 Beauclair 504-770-9503 504-770-9898 4
8 Overstreet 813-962-6926 813-974-4598 4
9 Rader 303-556-7463 303-556-8989 5
10 Himenez 505-774-6549 505-774-8934 5
11 O'Neill 215-666-5734 215-666-5700 6
12 Majeska 207-885-4983 207-885-4999 6
13 Politis 312-123-4567 312-1234576 4

Table2: Does_Business_in_t

Does_Business_in_t
Territory_ID Customer_ID
1 5
1 6
1 7
2 2
2 5
2 7
2 8
3 1
3 2
3 12
4 1
4 9
4 10
5 6
5 15
6 3
6 4
6 11
6 13
8 14

Table3: Customer_t

Customer_t
Customer_ID Customer_name Customer_address City State Postal_Code
001 Contemporary Casuals 1355 S. Hines Blvd. Gainsville FL 32601
002 Value Furniture 15145 S.W. 17th St. Plano TX 75094
003 Home Furnishings 1900 Allard Ave. Albany NY 12209
004 Eastern Furniture 1925 Beltline Rd. Carteret NJ 7008
005 Impressions 5585 Westcott Ct. Sacramento CA 94206
006 Furniture Gallery 325 Flatiron Dr. Boulder CO 80514
007 Period Furnishings 394 Rainbow Dr. Seattle WA 97954
008 California Classics 816 Peach Rd. Santa Clara CA 96915
009 M & H Casual Furniture 3709 First Street Clearwater FL 34620
010 Seminole Interiors 2400 Rocky Point Dr. Seminole FL 34646
011 American Euro Lifestyles 2424 Missouri Ave. N. Prospect Park NJ 7508
012 Battle Creek Furniture 345 Capitol Ave. SW Battle Creek MI 49015
013 Heritage Furnishings 66789 College Ave. Carlisle PA 17013
014 Kaneohe Homes 112 Kiowai St. Kaneohe HI 96744
015 Mountain Scenes 4132 Main Street Ogden UT 84403

Table4: Order_t

Order_t
Order_ID Order_Date Customer_ID
1001 10/21/2011 1
1002 10/25/2011 8
1003 10/26/2011 15
1004 10/27/2011 5
1005 11/24/2011 3
1006 11/27/2011 2
1007 11/28/2011 11
1008 12/3/2011 12
1009 12/5/2011 1
1010 1/16/2012 4
1011 1/1/2004 1

Table5: Order_line_t

Order_line_t
Order_ID Product_ID Quantity
1001 1 2
1001 2 2
1001 4 1
1002 3 5
1003 3 1
1004 6 2
1004 8 2
1005 4 4
1006 4 1
1006 5 2
1006 7 2
1007 1 3
1007 2 2
1008 3 2
1008 8 3
1009 4 2
1009 7 3
1010 8 10

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Beginning Apache Cassandra Development

Authors: Vivek Mishra

1st Edition

1484201426, 9781484201428

More Books

Students also viewed these Databases questions

Question

=+associated with political parties and if so, which ones? Are

Answered: 1 week ago