💻 Coding & Development Prompts
Python, JavaScript, SQL, debugging, API
← All Categories
1 prompts
in SQL & Database
SQL Query - Complex Joins and Aggregation
Write SQL queries for a database with tables: orders (id, customer_id, order_date, total), customers (id, name, email, city), products (id, name, price, category), order_items (order_id, product_id, quantity). Queries needed: 1) Top 10 customers by total spend, 2) Monthly revenue for last 12 months, 3) Best selling product per category, 4) Customers who ordered in January but not February, 5) Running total of sales by month (window function), 6) Products never ordered. Optimize for performance.
💡 Add indexes on columns used in WHERE, JOIN, and ORDER BY clauses.