You are on page 1of 22

Database Management System by

Michelle M. Esperal
FINAL LAB QUIZ 2
Completed on Tuesday, 8 August 2023, 7:16 PM

Time taken 55 mins 38 secs

Marks 16.00/20.00

Grade 80.00 out of 100.00

Question 1
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 display the Minimum firstname
concatenated to lastname? Look for the maximum salary that is less than 10000 per
department_id.
Question 1Select one:

a.

SELECT MIN(FIRSTNAME||LASTNAME)
FROM EMPLOYEES
GROUP BY DEPARTMENT_ID
HAVING MAX(SALARY);

b.

SELECT MIN(FIRSTNAME||LASTNAME)
FROM EMPLOYEES
HAVING MAX(SALARY)<10000
GROUP BY DEPARTMENT_ID;

c.

SELECT MIN(FIRSTNAME,LASTNAME)
FROM EMPLOYEES
GROUP BY DEPARTMENT_ID
HAVING MAX(SALARY)<10000;

d.

SELECT MIN(FIRSTNAME||LASTNAME)
FROM EMPLOYEES
GROUP BY DEPARTMENT_ID
HAVING MAX(SALARY)<10000;
Question 2
Incorrect

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

Question 2Select 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
GROUP BY DEPARTMENT_ID
WHERE DEPARTMENT_ID IN(90,50)
HAVING MIN(DEPARTMENT_ID)<=90;

d.

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


FROM EMPLOYEES
WHERE DEPARTMENT_ID IN(90,50)
GROUP BY DEPARTMENT_ID
HAVING(DEPARTMENT_ID)<=90;
Question 3
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 that display distinct job_id and the the total number
per distinct (unique) job_id.
Question 3Select one:

a.

SELECT DISTICT(JOB_ID), COUNT(JOB_ID) AS “TOTAL NUMBER OF JOB_ID”


FROM EMPLOYEES
GROUP BY JOB_ID;

b.

SELECT DISTICT(JOB_ID), COUNT*(JOB_ID) AS “TOTAL NUMBER OF JOB_ID”


FROM EMPLOYEES
GROUP BY JOB_ID;

c.

SELECT DISTICT((JOB_ID), COUNT(JOB_ID)) AS “TOTAL NUMBER OF JOB_ID”


FROM EMPLOYEES
GROUP BY JOB_ID;
d.

SELECT DISTICT(JOB_ID), COUNT(JOB_ID) AS “TOTAL NUMBER OF JOB_ID”


FROM EMPLOYEES;
Question 4
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 4Select one:

a.

SELECT MAX SALARY FROM EMPLOYEES;

b.

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

c.

SELECT COUNT (MAX(SALARY)) FROM EMPLOYEES;


d.

SELECT MAX(SALARY) FROM EMPLOYEES;


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

Question 5Select 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 6
Question text
Which of the following query is correct which will display the same output as shown below?

Select one:
a.

SELECT MIN(initcap(FIRSTNAME||' surnname is '||LASTNAME)) AS COMPLETE NAME,


MIN(MANAGER_ID) AS "LOWEST MANAGER_ID" FROM EMPLOYEES;

b.

SELECT MIN(LOWER(FIRSTNAME||surnname is ||LASTNAME)) AS "COMPLETE NAME",


MIN(MANAGER_ID) AS "LOWEST MANAGER_ID" FROM EMPLOYEES;

c.

SELECT MIN(LOWER(FIRSTNAME||' surnname is '||LASTNAME)) AS "COMPLETE NAME",


MIN(MANAGER_ID) AS "LOWEST MANAGER_ID" FROM EMPLOYEES;

d.

SELECT MIN(initcap(FIRSTNAME||' surnname is '||LASTNAME)) AS "COMPLETE NAME",


MIN(MANAGER_ID) AS "LOWEST MANAGER_ID" FROM EMPLOYEES;
Question 7
Incorrect

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

Question 7Select one:

a.

SELECT MIN(LASTNAME),MAX(FIRSTNAME),SUM(SALARY),AVG(SALARY)
FROM EMPLOYEES
WHERE JOB_ID LIKE 'ST%';

b.
SELECT MIN(LASTNAME),MAX(FIRSTNAME),SUM(SALARY),AVG(SALARY)
FROM EMPLOYEES
WHERE JOB_ID LIKE = ‘ST’;

c.

SELECT MIN(LASTNAME),MAX(FIRSTNAME),SUM(SALARY),AVG(SALARY)
FROM EMPLOYEES
WHERE JOB_ID LIKE '%ST';

d.

SELECT MIN(LASTNAME),MAX(FIRSTNAME),SUM(SALARY),AVG(SALARY)
FROM EMPLOYEES
WHERE JOB_ID LIKE '%ST%';
Question 8
Incorrect

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

Question 8Select one:

a.

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

b.

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

c.

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


d.

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


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 query that display the maximum lastname
concatenated to firstname and rename the column as “Employees Name”, Job_id and apply
the ff. functions:

 Count the Job_id; Apply where condition whose lastname ends with letter ‘N’; Group
the job_id; and Apply having clause of employees having average salary that is
greater than 10000.

Question 9Select one:

a.

SELECT MAX(LASTNAME||FIRSTNAME) AS "EMPLOYEES NAME", JOB_ID, COUNT(JOB_ID)


FROM EMPLOYEES
WHERE LASTNAME LIKE '%N'
GROUP BY JOB_ID
HAVING AVG(SALARY)<10000;
b.

SELECT MAX(LASTNAME||FIRSTNAME) AS EMPLOYEES NAME, JOB_ID, COUNT(JOB_ID)


FROM EMPLOYEES
WHERE LASTNAME LIKE '%N'
GROUP BY JOB_ID
HAVING AVG(SALARY)>10000;

c.

SELECT MAX(LASTNAME||FIRSTNAME) AS "EMPLOYEES NAME", JOB_ID, COUNT(JOB_ID)


FROM EMPLOYEES
WHERE LASTNAME LIKE '%N'
GROUP BY JOB_ID
HAVING AVG(SALARY)>10000;

d.

SELECT MAX(LASTNAME||FIRSTNAME) AS "EMPLOYEES NAME", JOB_ID, COUNT(JOB_ID)


FROM EMPLOYEES
GROUP BY JOB_ID
WHERE LASTNAME LIKE '%N'
HAVING AVG(SALARY)>10000;
Question 10
Question text
Which of the following query is correct which will display the same output as shown below?

Select one:

a.
SELECT MAX(LASTNAME||FIRSTNAME) AS NAME, MAX(SALARY)
FROM EMPLOYEES;

b.

SELECT MAX(LASTNAME||''||FIRSTNAME) AS NAME, MAX(SALARY)


FROM EMPLOYEES;

c.

SELECT MAX(LASTNAME||','||FIRSTNAME) AS NAME, MIN(SALARY)


FROM EMPLOYEES;

d.

SELECT MAX(LASTNAME||','||FIRSTNAME) AS NAME, MAX(SALARY)


FROM EMPLOYEES;
Question 11
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 lowest salary rename as
“LOWEST SALARY”, maximum salary rename as “HIGHEST SALARY” and department_id
concatenated to job_id?
Select one:

a.

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


FROM EMPLOYEES
GROUP BY JOB_ID,DEPARTMENT_ID;

b.

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


FROM EMPLOYEES
GROUP BY DEPARTMENT_ID;

c.

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


FROM EMPLOYEES;

d.

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


FROM EMPLOYEES
GROUP BY JOB_ID;
Question 12
Question text
Which of the following query is correct which will display the same output as shown below?

Select one:

a.
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;

b.

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


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

c.

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;

d.

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;
Question 13
Incorrect

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

a.

SELECT JOB_ID, COUNT(JOB_ID)"NO. OF JOB_ID", SUM(SALARY), AVG(SALARY)


FROM EMPLOYEES
GROUP BY JOB_ID;

b.

SELECT JOB_ID, COUNT(JOB_ID)"NO. OF JOB_ID", SUM(SALARY), AVG(SALARY)


FROM EMPLOYEES;

c.

SELECT JOB_ID, COUNT*(JOB_ID)"NO. OF JOB_ID", SUM(SALARY), AVG(SALARY)


FROM EMPLOYEES
GROUP BY JOB_ID;

d.

SELECT JOB_ID, COUNTDISTINCT(JOB_ID)"NO. OF JOB_ID", SUM(SALARY), AVG(SALARY)


FROM EMPLOYEES
GROUP BY JOB_ID;
Question 14
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 MINIMUM salary of employees
per job_id? Note job_id should be in lowercase.
Select one:

a.

SELECT MIN(SALARY) AS LOWEST SALARY, LOWER(JOB_ID)


FROM EMPLOYEES;

b.

SELECT MIN(SALARY) AS “LOWEST SALARY”, LOWER(JOB_ID)


FROM EMPLOYEES;

c.

SELECT MIN(SALARY) AS LOWEST SALARY, LOWER(JOB_ID)


FROM EMPLOYEES
GROUP BY JOB_ID;

d.
SELECT MIN(SALARY) AS “LOWEST SALARY”, LOWER(JOB_ID)
FROM EMPLOYEES
GROUP BY JOB_ID;
Question 15
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”.
Select 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 16
Question text
Which of the following query is correct which will display the same output as shown below?

Select one:

a.

SELECT COUNT(*) FROM EMPLOYEES;

b.

SELECT * FROM EMPLOYEES;

c.

SELECT COUNT ALL FROM EMPLOYEES;


Question 17
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.

Select one:

a.

SELECT MIN(LASTNAME), AVG(SALARY)


FROM EMPLOYEES
GROUP BY JOB_ID
WHERE JOB_ID LIKE ‘%REP%’
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 MIN(LASTNAME), AVG(SALARY)


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

d.

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


FROM EMPLOYEES
GROUP BY JOB_ID;
Question 18
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 minimum lastname?
Select one:

a.

SELECT COUNT (DISCTINCT MIN(LASTNAME)) FROM EMPLOYEES;


b.

SELECT MIN(LASTNAME) FROM EMPLOYEES;

c.

SELECT MIN LASTNAME FROM EMPLOYEES;

d.

SELECT COUNT (MIN(LASTNAME)) FROM EMPLOYEES;


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

Select one:

a.

SELECT MIN(LASTNAME), JOB_ID, MAX(SALARY)


FROM EMPLOYEES
WHERE JOB_ID LIKE 'REP%'
GROUP BY JOB_ID;

b.

SELECT MIN(LASTNAME), JOB_ID, MAX(SALARY)


FROM EMPLOYEES
WHERE JOB_ID LIKE '%REP%'
GROUP BY JOB_ID;
c.

SELECT MIN(LASTNAME), JOB_ID, MAX(SALARY)


FROM EMPLOYEES
WHERE JOB_ID LIKE '%REP%';

d.

SELECT MIN(LASTNAME), MIN(JOB_ID), MAX(SALARY)


FROM EMPLOYEES
WHERE JOB_ID LIKE '%REP%'
GROUP BY JOB_ID;
Question 20
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 display the Job_id and add the ff: function:

 Count the total number of job_id per distinct values; Compute for the summary of
salary per job_id; and Compute for the average salary per job_id
Select one:

a.

SELECT DISTINCT(JOB_ID), COUNT(JOB_ID) AS “NO. OF JOB_ID”, SUM(SALARY) AS “TOTAL


SALARY”, AVG(SALARY) AS “AVERAGE SALARY” FROM EMPLOYEES;

b.

SELECT DISTINCT(JOB_ID), COUNT(JOB_ID) AS “NO. OF JOB_ID”, SUM(SALARY) AS “TOTAL


SALARY”, AVG(SALARY) AS “AVERAGE SALARY” FROM EMPLOYEES GROUP BY JOB_ID;

c.

SELECT COUNT (DISTINCT(JOB_ID) AS “NO. OF JOB_ID”, SUM(SALARY) AS “TOTAL SALARY”,


AVG(SALARY) AS “AVERAGE SALARY” FROM EMPLOYEES GROUP BY JOB_ID;

d.

SELECT DISTINCT(JOB_ID), COUNT * (JOB_ID) AS “NO. OF JOB_ID”, SUM(SALARY) AS “TOTAL


SALARY”, AVG(SALARY) AS “AVERAGE SALARY” FROM EMPLOYEES GROUP BY JOB_ID;

You might also like