intermediate
Designing Efficient SQL Queries
Create optimized SQL queries for data retrieval
📝 Contenido del prompt
I need to design a SQL query for a database with tables: users (id, name, email, created_at), orders (id, user_id, total, status, date), and order_items (id, order_id, product_id, quantity, price). The query should return the top 10 customers by total spending in the last 30 days, including their name, email, total spent, and number of orders. The query should be efficient and handle large datasets.