Amazon Interview Question

Difference between where and having

Interview Answer

Anonymous

Jul 8, 2022

WHERE Clause 1. is used to filter the records from the table based on the specified condition. 2. can be used without GROUP BY Clause 3. implements in row operations 4. cannot contain aggregate function 5. can be used with SELECT, UPDATE, DELETE statement. 6. is used before GROUP BY Clause. 7. is used with single row function like UPPER, LOWER etc. HAVING Clause 1. is used to filter record from the groups based on the specified condition. 2. cannot be used without GROUP BY Clause. 3. implements in column operation. 4. can contain aggregate function. 5. can only be used with SELECT statement. 6. is used after GROUP BY Clause. 7. is used with multiple row function like SUM, COUNT etc.