0% found this document useful (0 votes)
162 views

Database Management System Final Q2

This document summarizes the results of a final quiz on database management systems. Michelle M. Esperal received a score of 8 out of 10 (80%) on the quiz completed on August 8, 2023 at 7:56 PM. The quiz consisted of 10 multiple choice questions testing knowledge of SQL queries.

Uploaded by

Michelle Esperal
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
162 views

Database Management System Final Q2

This document summarizes the results of a final quiz on database management systems. Michelle M. Esperal received a score of 8 out of 10 (80%) on the quiz completed on August 8, 2023 at 7:56 PM. The quiz consisted of 10 multiple choice questions testing knowledge of SQL queries.

Uploaded by

Michelle Esperal
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Database Management System by

Michelle M. Esperal
Final Quiz 2
Completed on Tuesday, 8 August 2023, 7:56 PM

Marks 8.00/10.00

Grade 80.00 out of 100.00

Question 1
Question text
Which of the following query is correct which will display the same output as shown below?

Question 1Select one:

a.

SELECT COUNT(DISTINCT MANAGER_ID) AS NO. OF MANAGER_ID FROM EMPLOYEES;

b.

SELECT COUNT(MANAGER_ID) AS "NO. OF MANAGER_ID" FROM EMPLOYEES;

c.

SELECT COUNT *(DISTINCT MANAGER_ID) AS "NO. OF MANAGER_ID" FROM EMPLOYEES;

d.

SELECT COUNT(DISTINCT MANAGER_ID) AS "NO. OF MANAGER_ID" FROM EMPLOYEES;


Question 2
Question text
Which of the following query is correct which will display the same output as shown below?

Question 2Select one:

a.

SELECT MAX(FIRSTNAME), MANAGER_ID, COUNT(SALARY), AVG(SALARY)


FROM EMPLOYEES
WHERE SALARY BETWEEN 10000 AND 6000
GROUP BY MANAGER_ID
HAVING MIN(SALARY) >= 5000;

b.

SELECT MAX(FIRSTNAME), MANAGER_ID, COUNT(SALARY), AVG(SALARY)


FROM EMPLOYEES
GROUP BY MANAGER_ID
WHERE SALARY BETWEEN 6000 AND 10000
HAVING MIN(SALARY) >= 5000;

c.

SELECT MAX(FIRSTNAME), MANAGER_ID, COUNT(SALARY), AVG(SALARY)


FROM EMPLOYEES
WHERE SALARY BETWEEN 6000 AND 10000
GROUP BY MANAGER_ID
HAVING (SALARY) >= 5000;
d.

SELECT MAX(FIRSTNAME), MANAGER_ID, COUNT(SALARY), AVG(SALARY)


FROM EMPLOYEES
WHERE SALARY BETWEEN 6000 AND 10000
HAVING MIN(SALARY) >= 5000
GROUP BY MANAGER_ID;
Question 3
Incorrect

Question text

SELECT COUNT (AVG(PRICE)) FROM STOCKS GROUP BY WAREHOUSE;


5
Answer: Question 3

Question 4
Question text

SELECT COUNT(*) FROM STOCKS;


9
Answer: Question 4
Question 5
Question text

SELECT AVG(NVL(QTY,0)) FROM STOCKS;


8.22
Answer: Question 5

Question 6
Question text
Choose the letter of the correct answer based on the table EMPLOYEES as shown below.
Table 1.0 EMPLOYEES

Which of the following is the correct query that counts the number of ST_CLERK job_id?
Rename the column as “Total no. of ST_CLERK”.
Question 6Select one:

a.

SELECT COUNT(JOB_ID), AS “TOTAL NO. OF ST_CLERK”


FROM EMPLOYEES
WHERE JOB_ID != ‘ST_CLERK’;

b.

SELECT COUNT(JOB_ID), AS TOTAL NO. OF ST_CLERK


FROM EMPLOYEES
WHERE JOB_ID = ‘ST_CLERK’;

c.

SELECT COUNT(JOB_ID), AS “TOTAL NO. OF ST_CLERK”


FROM EMPLOYEES
WHERE JOB_ID = ‘ST_CLERK’;

d.

SELECT COUNT * (JOB_ID), AS “TOTAL NO. OF ST_CLERK”


FROM EMPLOYEES
WHERE JOB_ID = ‘ST_CLERK’;
Question 7
Question text
Choose the letter of the correct answer based on the table EMPLOYEES as shown below.
Table 1.0 EMPLOYEES
Which of the following is the correct query that displays the maximum salary?
Question 7Select one:

a.

SELECT MAX SALARY FROM EMPLOYEES;

b.

SELECT COUNT (MAX(SALARY)) FROM EMPLOYEES;

c.

SELECT COUNT (DISCTINCT MAX(SALARY)) FROM EMPLOYEES;

d.

SELECT MAX(SALARY) FROM EMPLOYEES;


Question 8
Question text

SELECT AVG(NVL(QTY,0)) FROM STOCKS;


8.22
Answer: Question 8

Question 9
Question text
Choose the letter of the correct answer based on the table EMPLOYEES as shown below.
Table 1.0 EMPLOYEES
Which of the following is the correct report that display the smallest (minimum) Surname..
and apply the ff. functions:

 Get the average salary; Group the data per job_id; Get only job_id with a keyword
“REP”; and Apply having clause, which the max salary per job_id is greater than 5000.

Question 9Select one:

a.

SELECT MIN(LASTNAME), AVG(SALARY)


FROM EMPLOYEES
WHERE JOB_ID LIKE ‘%REP%’
GROUP BY JOB_ID
HAVING MAX(SALARY)>500;

b.

SELECT MIN(LASTNAME), AVG(SALARY)


FROM EMPLOYEES
WHERE JOB_ID NOT LIKE ‘%REP%’
GROUP BY JOB_ID
HAVING MAX(SALARY)>500;
c.

SELECT CONCAT(DEPARTMENT_ID,JOB_ID),MIN(SALARY), MAX(SALARY)


FROM EMPLOYEES
GROUP BY JOB_ID;

d.

SELECT MIN(LASTNAME), AVG(SALARY)


FROM EMPLOYEES
GROUP BY JOB_ID
WHERE JOB_ID LIKE ‘%REP%’
HAVING MAX(SALARY)>500;
Question 10
Incorrect

Question text
Which of the following query is correct which will display the same output as shown below?

Question 10Select one:

a.

SELECT MIN(LASTNAME||FIRSTNAME) AS NAME, DEPARTMENT_ID


FROM EMPLOYEES
WHERE DEPARTMENT_ID IN(90,50)
HAVING MIN(DEPARTMENT_ID)<=90;

b.

SELECT MIN(LASTNAME||FIRSTNAME) AS NAME, DEPARTMENT_ID


FROM EMPLOYEES
WHERE DEPARTMENT_ID IN(90,50)
GROUP BY DEPARTMENT_ID
HAVING MIN(DEPARTMENT_ID)<=90;

c.

SELECT MIN(LASTNAME||FIRSTNAME) AS NAME, DEPARTMENT_ID


FROM EMPLOYEES
WHERE DEPARTMENT_ID IN(90,50)
GROUP BY DEPARTMENT_ID
HAVING(DEPARTMENT_ID)<=90;

d.

SELECT MIN(LASTNAME||FIRSTNAME) AS NAME, DEPARTMENT_ID


FROM EMPLOYEES
GROUP BY DEPARTMENT_ID
WHERE DEPARTMENT_ID IN(90,50)
HAVING MIN(DEPARTMENT_ID)<=90;

You might also like