CS FundamentalsEasyWipro · Cognizant pattern
Which SQL clause filters groups AFTER aggregation?
- A. HAVING
- B. WHERE
- C. GROUP BY
- D. ORDER BY
Correct answer: A. HAVING
WHERE filters individual rows before grouping and cannot use aggregates; HAVING filters the groups formed by GROUP BY and can test COUNT, SUM, AVG and so on.
More DBMS and SQL questions
- Which statement about the SQL command TRUNCATE TABLE is correct?
- Table Emp(id, name, dept, salary, mgr) rows: (1, 'Asha', 'HR', 50000, NULL), (2, 'Ravi', 'IT', 70000, 1), (3, 'Meena', 'IT', 70000, 2)…
- Table Emp(id, name, dept, salary, mgr) rows: (1, 'Asha', 'HR', 50000, NULL), (2, 'Ravi', 'IT', 70000, 1), (3, 'Meena', 'IT', 70000, 2)…
- Two tables have 6 rows and 4 rows. How many rows does SELECT FROM A, B; (no WHERE clause) return?
- A relation is in 2NF if it is in 1NF and:
- R(A, B, C, D) has functional dependencies A → B and B → C. What is the candidate key of R?