This forum is intended for solutioning and discussion of specific topics. Please check out the sub sidebar and wiki content for beginner resources. Also be sure to checkout r/learnSQL
try this: take any table of orders (customer, product, amount, date). find customers who ordered once and never again (LEFT JOIN + IS NULL on a later order), then daily revenue per product, keeping only days above a threshold (HAVING). i built a platform with exercises like this, specialized in blockchain and crypto data, in case that's a field you're curious about: https://unchaindata.xyz/wizard-camp
•
u/SQL-ModTeam 26d ago
This forum is intended for solutioning and discussion of specific topics. Please check out the sub sidebar and wiki content for beginner resources. Also be sure to checkout r/learnSQL
2
u/Professional_Shoe392 27d ago
There is a GitHub repo here of SQL puzzles. You can use AI to modify the scripts to Postgres (its currently SQL Server TSQL).
AdvancedSQLPuzzles/Advanced SQL Puzzles at main · smpetersgithub/AdvancedSQLPuzzles
1
u/MrRoy_SQL 27d ago
heres one i like, uses exactly what youve covered:
orders(order_id, customer_id, order_date, amount, status) where status is completed or refunded
customers(customer_id, name, city)
make up 10-15 rows yourself, put a NULL city and a customer with no orders in there on purpose. #2 and #4 are where most ppl trip up
1
u/decrementsf 26d ago
It is traditional to get Doom running on PostgreSQL as an introductory exercise.
1
u/vchae 26d ago
try this: take any table of orders (customer, product, amount, date). find customers who ordered once and never again (LEFT JOIN + IS NULL on a later order), then daily revenue per product, keeping only days above a threshold (HAVING). i built a platform with exercises like this, specialized in blockchain and crypto data, in case that's a field you're curious about: https://unchaindata.xyz/wizard-camp