
DBMS-Aggregate Methods (GroupBy & Having Class)
Authored by KarunaiMuthu SriRam
Computers
University
Used 1+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
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
16 questions
E-Commerce
Quiz
•
University - Professi...
12 questions
Java History Characteristics Environment
Quiz
•
University
15 questions
8051-MCQ
Quiz
•
University
20 questions
Control Structures C#
Quiz
•
University
11 questions
HTML Postest
Quiz
•
University
12 questions
Microsoft Office Word
Quiz
•
4th Grade - University
15 questions
PICMAKER
Quiz
•
University
10 questions
Industry 4.0 Unit 1
Quiz
•
University
Popular Resources on Wayground
7 questions
History of Valentine's Day
Interactive video
•
4th Grade
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
15 questions
Valentine's Day Trivia
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
Discover more resources for Computers
18 questions
Valentines Day Trivia
Quiz
•
3rd Grade - University
12 questions
IREAD Week 4 - Review
Quiz
•
3rd Grade - University
23 questions
Subject Verb Agreement
Quiz
•
9th Grade - University
5 questions
What is Presidents' Day?
Interactive video
•
10th Grade - University
7 questions
Renewable and Nonrenewable Resources
Interactive video
•
4th Grade - University
20 questions
Mardi Gras History
Quiz
•
6th Grade - University
10 questions
The Roaring 20's Crash Course US History
Interactive video
•
11th Grade - University
17 questions
Review9_TEACHER
Quiz
•
University