SQL QUIZ 2
SQL QUIZ 2
"
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
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.