SSC IMD SA Mock 02 – Question 153

Question:

In SQL, what is the key difference between the WHERE clause and the HAVING clause?
SQL में WHERE क्लॉज और HAVING क्लॉज के बीच मुख्य अंतर क्या है?

Options:

  • WHERE filters individual rows before grouping, whereas HAVING filters aggregated groups after GROUP BY
  • WHERE is used only with subqueries, while HAVING is used with joins
  • HAVING cannot be used without the ORDER BY clause
  • Both are completely interchangeable in all SQL queries
  • WHERE ग्रुपिंग से पहले अलग-अलग पंक्तियों को फ़िल्टर करता है, जबकि HAVING GROUP BY के बाद एकत्रित समूहों को फ़िल्टर करता है
  • WHERE केवल सबक्वेरी के साथ प्रयोग होता है
  • HAVING का प्रयोग ORDER BY के बिना नहीं हो सकता
  • दोनों पूरी तरह से विनिमेय हैं

Correct Answer: a)

Explanation:

The WHERE clause filters base table rows before any aggregate functions or grouping occurs. The HAVING clause filters groups formed by the GROUP BY clause based on aggregate conditions (e.g. HAVING COUNT(*) > 5).
WHERE पंक्तियों को एग्रीगेशन से पहले फ़िल्टर करता है, जबकि HAVING का उपयोग GROUP BY के बाद समूहों पर स्थितियाँ (जैसे COUNT, SUM) लागू करने के लिए किया जाता है।

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top