DBMS-Aggregate Methods (GroupBy & Having Class)

DBMS-Aggregate Methods (GroupBy & Having Class)

University

15 Qs

quiz-placeholder

Similar activities

Data Mining - Classification Mining

Data Mining - Classification Mining

University

15 Qs

Quiz # 1 in Capstone Project and Research 1

Quiz # 1 in Capstone Project and Research 1

University

15 Qs

Quiz on List and Tuples

Quiz on List and Tuples

University

16 Qs

Week 5: Test your understanding part 1

Week 5: Test your understanding part 1

University

20 Qs

Introduction to Networking

Introduction to Networking

University

15 Qs

The AI Shield

The AI Shield

University

15 Qs

UAS PTIK D 2020 TOPIK KHUSUS MULTIMEDIA

UAS PTIK D 2020 TOPIK KHUSUS MULTIMEDIA

University

20 Qs

DBMS-Aggregate Methods (GroupBy & Having Class)

DBMS-Aggregate Methods (GroupBy & Having Class)

Assessment

Quiz

Computers

University

Practice Problem

Hard

Created by

KarunaiMuthu SriRam

Used 1+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

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

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?