Question
CLIENT ClientId LastName FirstName Suburb Phone City 1 Jason Rita Bella Boulevard 3432422 Sydney 2 Smith Jackson HighPark 5535333 Sydney 3 Wagner James Richmond 4425253
CLIENT
ClientId | LastName | FirstName | Suburb | Phone | City |
1 | Jason | Rita | Bella Boulevard | 3432422 | Sydney |
2 | Smith | Jackson | HighPark | 5535333 | Sydney |
3 | Wagner | James | Richmond | 4425253 | Perth |
4 | Blake | Susan | Rockdale | 5141412 | Brisbane |
5 | Jones | Tania | Como | 5474574 | Melbourne |
6 | Lynn | Karina | Dural | 1231241 | Sydney |
7 | Walters | Max | HighPark | 4574774 | Perth |
8 | Poplar | Liam | Crasspark | 1312425 | Brisbane |
9 | Robb | Noah | Elwood | 6746236 | Melbourne |
10 | Henlon | James | Hawthrone | 1235636 | Darwin |
ORDER
OrderNo | OrderDesc | ClientId | OrderDate | ShippedDate | Country | Total Amount |
17895 | Large Item | 3 | 12/10/18 | 16/10/18 | Australia | 200.50 |
21678 | Small Item | 2 | 05/01/19 | 09/01/19 | Italy | 300.00 |
22456 | Item ABC | 4 | 10/03/19 | 12/03/19 | France | 400.75 |
24562 | Medium Item | 2 | 26/12/19 | 27/12/19 | Australia | 150.00 |
34764 | 3 Tier Design | 5 | 18/07/20 | 20/07/20 | Japan | 370.60 |
36533 | Round Box | 8 | 22/09/20 | 27/09/20 | Australia | 190.85 |
36536 | Brand-005 | 3 | 22/09/20 | 24/09/20 | China | 216.75 |
37454 | Express Delivery | 1 | 11/11/20 | 14/11/20 | Denmark | 625.00 |
Questions:
- Write CREATE and INSERT statements for the above tables and identify constraints. Make sure primary key, foreign key, not null and other constraints are included in table creation scripts.
- Write SQL statements to fulfil the following requirements and provide the screenshot of the output:
- Display Order details in descending order of country.
- Display Order Id, Order Description, and country for all orders that have shipped to Australia or Italy. Display results in descending order of country.
- Display sum of total amount of orders placed in 2019.
- Display orderID, Order Description, Client ID, Client firstname , and total amount related to all orders that have total amount greater tha $200 and country name has latter A in middle.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started