🏠 الرئيسية
المقاييس
📊 جميع المقاييس 🦖 ديناصور v1 🦖 ديناصور v2 ✅ تطبيقات قائمة المهام 🎨 صفحات حرة إبداعية 🎯 FSACB - العرض النهائي 🌍 مقياس الترجمة
النماذج
🏆 أفضل 10 نماذج 🆓 نماذج مجانية 📋 جميع النماذج ⚙️ كيلو كود
الموارد
💬 مكتبة الأوامر 📖 قاموس الذكاء الاصطناعي 🔗 روابط مفيدة
intermediate

Designing Efficient SQL Queries

#sql #database #query-optimization

Create optimized SQL queries for data retrieval

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.