0% found this document useful (0 votes)
3 views2 pages

SQL QUIZ 2

The document outlines various customer updates and retrieval requests, including changing customer countries and ages, categorizing customers based on their orders and spending, and inserting new customers and orders. It specifies conditions for retrieving customers with pending shipping statuses and those from specific countries. Additionally, it includes instructions for updating shipping records and filtering customers based on their order amounts and statuses.

Uploaded by

hannahlulu2430
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

SQL QUIZ 2

The document outlines various customer updates and retrieval requests, including changing customer countries and ages, categorizing customers based on their orders and spending, and inserting new customers and orders. It specifies conditions for retrieving customers with pending shipping statuses and those from specific countries. Additionally, it includes instructions for updating shipping records and filtering customers based on their order amounts and statuses.

Uploaded by

hannahlulu2430
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Update Betty Doe’s country to "USA.

"

Retrieve all customers who have a pending Insert a new order for customer_id 3, buying a
shipping status and categorize them based on "Speakers" for 900.
age:
Retrieve all customers who have placed an order
a. "Minor" if under 18 for either "Mouse" or "Keyboard" and have spent
b. "Young Adult" if between 18 and 40 more than 300.
c. "Senior" if over 40

Add a new shipping record for customer_id 2


Update Betty Doe’s country to "USA." with status "Delivered."

Retrieve all customers who have placed an order Retrieve all customers who either have a
and categorize them based on the total number "Pending" shipping status or are from "Germany."
of orders they have made: Display results sorted by country in alphabetical
order.
a. "Single Order" if they have only one
order
b. "Multiple Orders" if they have more
Insert a new order for customer_id 3, buying a
than one order
"Speakers" for 900.
Add a new customer named "Alice Green," age
Retrieve all customers who have placed an order
30, from "Germany."
for either "Mouse" or "Keyboard" and have spent
Retrieve all customers who have placed an order more than 300.
and categorize them based on the total number
of orders they have made:
Add a new shipping record for customer_id 2
• "Single Order" if they have only one order
with status "Delivered."
• "Multiple Orders" if they have more than
Retrieve all customers who either have a
one order
"Pending" shipping status or are from "Germany."
Display results sorted by country in alphabetical
Update Sophia Anderson’s age to 27 and change
order.
her country to "Germany."

Retrieve all customers who have placed an order Add a new customer named "Ethan Clark," age
and categorize them based on their total spending:
34, from "Japan," and immediately insert an order
• "Low Spender" if they spent less than 500 for him, buying a "Tablet" for 1200.
• "Medium Spender" if they spent between Retrieve all customers who are either from "USA"
500 and 1000 or "UK," are older than 25, and have placed at
• "High Spender" if they spent more than 1000 least one order. Sort the results by age in
descending order.
Update John Reinhardt’s age to 26, and change
his country to "Germany."
Update Isabella Martinez’s country to "Portugal"
Retrieve all customers who have an order and increase her age by 1.
amount greater than 500 or have a shipping
Retrieve all customers who have placed an order
status of "Pending," but exclude those from the
for a "Monitor" or have a pending shipping status,
USA.
but exclude those from Canada.

Update Robert Luna’s country to "Mexico" and


Update Robert Luna’s country to "Mexico" and
add a shipping record for him with status
add a shipping record for him with status
"Pending."
"Pending."
Retrieve all customers who have a shipping
Retrieve all customers who have a shipping
status of "Delivered" and have placed an order
status of "Delivered" and have placed an order
greater than 1000. Join with the Orders table to
greater than 1000. Join with the Orders table to
display both customer names and their highest
display both customer names and their highest
order amount.
order amount.

Update James Hernandez’s age to 29 and change


his country to "Chile."
Insert a new customer named "Sophia Adams,"
Retrieve all customers older than 25 and from
age 40, from "Spain," and give her a pending
either "USA" or "Canada"
shipping status.

Retrieve all customers who have placed an order


Update David Robinson’s age to 23 and change and either have an age below 25 or are from
his country to "Italy." "France," but exclude those who purchased a
Monitor.
Retrieve all customers who have placed an order
where the amount is greater than 700 or have a
shipping status of "Delivered," but exclude those
from the UK.

You might also like