facebook pixel
Day 1/7 - SQL Challenge 🎯 TODAY’S QUESTION: Find all customers who have made purchases over $100. TABLES: Customers (id, name, email) Orders (id, customer_id, amount, order_date) THE SOLUTION: sqlSELECT DISTINCT c.name FROM Customers c JOIN Orders o ON c.id = o.customer_id WHERE o.amount > 100; WHY THIS MATTERS: Tests basic JOIN understanding DISTINCT is crucial (one customer can have multiple orders) 30% of candidates forget DISTINCT in interviews COMMON MISTAKES: ❌ Forgetting DISTINCT (returns duplicate customers) ❌ Using WHERE instead of ON for join condition ❌ Not aliasing tables (makes query harder to read) ALTERNATIVE SOLUTION (using IN): sqlSELECT name FROM Customers WHERE id IN ( SELECT DISTINCT customer_id FROM Orders WHERE amount > 100 ); INTERVIEW TIP: Always ask: “Should I return duplicate names or unique names?” Clarify before coding. Day 1/7 complete ✅ Comment ‘DONE’ when you solve it! #SQLChallenge #Day1 #DataScience #SQL #TechInterview FAANG

 15.1k

 382

 18

 15.1k

    Suggested Credits
    Tags, Events, and Projects