
DBMS-Aggregate Methods (GroupBy & Having Class)
Quiz
•
Computers
•
University
•
Practice Problem
•
Hard
KarunaiMuthu SriRam
Used 1+ times
FREE Resource
Enhance your content in a minute
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following query?
SELECT department_id, SUM(salary)
FROM employees
GROUP BY department_id;
The sum of all salaries in the table.
The sum of salaries for each employee.
The sum of salaries grouped by department_id.
An error because of missing WHERE clause.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is true about the GROUP BY clause?
It can be used with aggregate functions.
It must be used with a HAVING clause.
It is always used with a WHERE clause.
It cannot be used with ORDER BY clause.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which statement will cause an error?
SELECT department_id, COUNT(*) FROM employees GROUP BY department_id;
SELECT department_id, salary FROM employees GROUP BY department_id;
SELECT department_id, AVG(salary) FROM employees GROUP BY department_id;
SELECT department_id, MAX(salary) FROM employees GROUP BY department_id;
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of the HAVING clause in a GROUP BY query?
To filter rows before grouping.
To filter groups after aggregation.
To sort the results of the grouping.
To combine results of two queries.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following queries is valid?
SELECT job_id, SUM(salary) FROM employees GROUP BY job_id, department_id;
SELECT job_id, department_id, SUM(salary) FROM employees GROUP BY job_id;
SELECT job_id, department_id, SUM(salary) FROM employees GROUP BY job_id, department_id;
SELECT job_id, department_id, SUM(salary) FROM employees;
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the result of this query?
SELECT manager_id, COUNT(*)
FROM employees
WHERE department_id = 50
GROUP BY manager_id
HAVING COUNT(*) > 2;
It counts the number of employees for each manager in department 50 where the count is greater than 2.
It groups by department_id and filters the count greater than 2.
It groups by manager_id and department_id and counts employees where count > 2.
It filters employees with count greater than 2 before grouping by manager_id.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Given the query below, what does it do?
SELECT job_id, AVG(salary)
FROM employees
GROUP BY job_id
ORDER BY AVG(salary) DESC;
Groups employees by job_id and shows average salary.
Groups employees by salary and shows average job_id.
Orders the employees by salary in descending order before grouping.
Groups employees by job_id and shows average salary in ascending order.
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
14 questions
Semi-Long Quiz#1 - SAM, NW3A-3E
Quiz
•
University
18 questions
Quiz on Misinformation and Bias
Quiz
•
10th Grade - University
10 questions
pointers and structures
Quiz
•
University
20 questions
COA_QUIZ_UNIT I
Quiz
•
University
11 questions
What is a computer
Quiz
•
KG - University
12 questions
PSSI Chp 1 dan 2
Quiz
•
University
16 questions
Algo Quiz
Quiz
•
University
20 questions
UNIT IV Normalization
Quiz
•
University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
54 questions
Analyzing Line Graphs & Tables
Quiz
•
4th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
