Post by Somya Barolia

App Development & Support Lead | L2/L3 | ITSM/ITIL | SQL | Java | System Integration & Data Migration | AI-Assisted Dev Trainer | Accenture • Infosys | 📍 Based in Doha - Valid QID | Open to Opportunities

🔥 SQL Challenge: Can you solve this without running the query? Most people think they know GROUP BY, HAVING, and NULL behavior… until they see this. 📊 Table: Sales id product amount ---------------------- 1 A 100 2 A NULL 3 B 200 4 B 200 5 C NULL 6 C 300 💻 Query: SELECT product, COUNT(amount), SUM(amount), COUNT(*), SUM(amount) / COUNT(amount) FROM Sales GROUP BY product HAVING SUM(amount) >= 200; ❓ Question: What will be the final output? ⚠️ Think about: NULL impact on SUM() and COUNT(column) Difference: COUNT(*) vs COUNT(column) Query flow: FROM → GROUP BY → HAVING → SELECT 👇 Write the final output in comments before checking results.