Database-Management-System
August 29, 2024Database-Management-System
August 29, 2024Database-Management-System
Question 717 |
Consider the following EMP table and answer the question below:
Which of the following select statement should be executed if we need to display the average salary of employees who belongs to grade “E4”?
Which of the following select statement should be executed if we need to display the average salary of employees who belongs to grade “E4”?
Select avg(salary) from EMP whose grade=”E4”; | |
Select avg(salary) from EMP having grade=”E4”; | |
Select avg(salary) from EMP group by grade where grade=”E4”; | |
Select avg(salary) from EMP group by grade having grade=”E4”; |
Question 717 Explanation:
→ Condition specified in WHERE clause is used while fetching data (rows) from table, and data which doesn’t pass the condition will not be fetched into result set,
→ HAVING clause is used to filter summarized data or grouped data.
→ In the question, we require average salary of employees whose grade is E4. So we require grouped data.
→ HAVING clause is used to filter summarized data or grouped data.
→ In the question, we require average salary of employees whose grade is E4. So we require grouped data.
Correct Answer: D
Question 717 Explanation:
→ Condition specified in WHERE clause is used while fetching data (rows) from table, and data which doesn’t pass the condition will not be fetched into result set,
→ HAVING clause is used to filter summarized data or grouped data.
→ In the question, we require average salary of employees whose grade is E4. So we require grouped data.
→ HAVING clause is used to filter summarized data or grouped data.
→ In the question, we require average salary of employees whose grade is E4. So we require grouped data.