IDSc 3103 Practice Final Exam 100 Points
Time 100 minutes
Notes: All Queries Use the Enhanced Customer Database (Create code in
SQL Scripts folder) on class page.
Hint: In many questions, using fields in the Purchases table is the easiest
way to write the query.
Write the SQL code in the box for each question (like you did in Homework
2)
--------------------------------------
Question 0: Generate ERD
a. Generate the ERD for the Enhanced Customer Database. How many
tables does it have?
b. List Customer_name, membership_level, city and state sorted by City
(ascending), State (descending)
Question 1: Customer Name Search
Business Question: The marketing team wants to send personalized emails
to customers whose first names start with 'M' or last names contain 'son'.
Find all such customers to create a targeted mailing list.
Display: customer_name, city, membership_level
Question 2: High-Value Product Analysis
Business Question: Management wants to identify premium products for a
luxury catalog. Find all products priced between $500 and $1000 in the
'Electronics' category.
Display: product_name, category, unit_price (sorted by price descending)
Question 3: Customer Purchase History
Business Question: The sales team needs a report showing which customers
bought which products. Create a list of all purchases with customer and
product details.
Display: customer_name, product_name, quantity, purchase_amount,
purchase_date
Question 4: Gold Member Electronics Purchases
Business Question: To evaluate our premium customer segment, find all
Gold membership customers who have purchased Electronics products. This
will help us understand their buying patterns.
Display: customer_name, city, product_name, purchase_amount,
purchase_date (sorted by purchase_amount descending)
Question 5: Monthly Sales Summary
Business Question: The finance department needs a monthly sales
breakdown for 2024. Show total sales and number of purchases for each
month.
Display: month_number, total_sales, number_of_purchases (sorted by
month)
Bonus points: Modify the code to add month_name to the output.
Question 6: Customer Value Segmentation
Business Question: Classify customers based on their total spending to
create targeted marketing campaigns. Categorize them as 'High Value'
(>$1500), 'Medium Value' ($500-$1500), or 'Low Value' (<$500).
Display: customer_name, total_spent, value_category (sorted by total_spent
descending)
Question 7: Quarter 1 Purchase Patterns
Business Question: Analyze first quarter (January-March) 2024 purchasing
behavior. How many days has it been since each Q1 purchase was made?
(Use May 31, 2024 as the reference date)
Display: customer_name, purchase_date, days_since_purchase (sorted by
days_since_purchase)
Question 8: Category Performance with Customer Insights
Business Question: Create a comprehensive category performance report
showing total revenue, number of purchases, number of unique customers,
and average purchase amount per category. The category field is in the
Purchases and the Product tables. Management needs this for strategic
planning.
Display: category, total_revenue, number_of_purchases, unique_customers,
avg_purchase_amount (sorted by total_revenue descending)
Bonus points: Modify the code to round the Avg_purchase amount to 2
digits.
Question 9: High-Performing Categories
Business Question: Identify product categories that are performing
exceptionally well. Find categories with total revenue exceeding $5,000
AND having at least 10 purchases.
Display: category, total_revenue, number_of_purchases,
avg_purchase_amount (sorted by total_revenue descending)
Bonus points: Modify the code to round the Avg_purchase amount to 2
digits.