
DBMS-Aggregate Methods (GroupBy & Having Class)

Quiz
•
Computers
•
University
•
Hard
KarunaiMuthu SriRam
Used 1+ times
FREE Resource
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.
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
Lab 5 Review Quiz - Functions and Subqueries

Quiz
•
University
19 questions
SQL4-Join/aggregate functions/group by

Quiz
•
University
10 questions
SYS 1591

Quiz
•
University
19 questions
Database Management Systems

Quiz
•
University
20 questions
SQL_2

Quiz
•
University
10 questions
DBMS Lab Quiz 1 2B3

Quiz
•
University
12 questions
SQL Questions

Quiz
•
University
15 questions
Quiz de SQL Básico

Quiz
•
University
Popular Resources on Wayground
18 questions
Writing Launch Day 1

Lesson
•
3rd Grade
11 questions
Hallway & Bathroom Expectations

Quiz
•
6th - 8th Grade
11 questions
Standard Response Protocol

Quiz
•
6th - 8th Grade
40 questions
Algebra Review Topics

Quiz
•
9th - 12th Grade
4 questions
Exit Ticket 7/29

Quiz
•
8th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
19 questions
Handbook Overview

Lesson
•
9th - 12th Grade
20 questions
Subject-Verb Agreement

Quiz
•
9th Grade