Calculate age in years from DOB

Hard
2 views 23 Jan 2026
Customers(dob). Return customer_id and age_years as integer (approx)....

Uppercase and trim names

Easy
2 views 23 Jan 2026
Return customer names trimmed and in uppercase....

Extract year from a date

Easy
2 views 23 Jan 2026
From Orders, return order_id and order_year....

Round price to 2 decimals

Easy
2 views 23 Jan 2026
Show product_id and rounded price....

COALESCE for missing phone

Easy
2 views 23 Jan 2026
Show customer_id and phone, but display 'NA' when phone is null....

String length check

Easy
2 views 23 Jan 2026
List products where name length is more than 20 characters....

Format a date column

Medium
5 views 23 Jan 2026
Show Orders with a formatted date string like YYYY-MM-DD....

Bucket customers by spend

Medium
2 views 23 Jan 2026
Create spend_bucket as LOW (20000) using CASE on total spend....

Top 3 orders per customer

Medium
2 views 23 Jan 2026
Return top 3 orders by total_amount for each customer....

Lead/lag for day-to-day change

Medium
3 views 23 Jan 2026
For daily sales, show today_sales and change_from_yesterday....

Generate a running total

Medium
2 views 23 Jan 2026
For Orders sorted by order_date, show running sum of total_amount....

Detect outliers using percentile

Hard
3 views 23 Jan 2026
Find employees whose salary is above the 90th percentile in their department....

Normalize text for search

Hard
3 views 23 Jan 2026
Create a query that removes spaces and lowercases product names for matching a user input....

Sessionize events

Hard
2 views 23 Jan 2026
In LoginLogs(user_id, logged_at), start a new session if gap > 30 minutes. Assign session_number per user....

Find median order value

Hard
4 views 23 Jan 2026
Compute the median of Orders.total_amount....