You are on page 1of 83

D.

department_name = 'Finance' 
ORDER BY "ANNUAL SALARY" DESC
c. SELECT E.employee_id, E.last_name,
E.first_name, D.department_name, E.salary*12 AS
"ANNUAL SALARY", D.location_id
Flag question
FROM employees E 
Question text JOIN jobs J ON E.job_id = J.job_id
JOIN departments D ON E.department_id =
In creating Joins,the NATURALJOIN and USING D.department_id
clauses are____________ WHERE D.location_id = 1700 AND
Select one: D.department_name = 'Finance' 
ORDER BY "ANNUAL SALARY" DESC
a. Mutually Inclusive
d. SELECT E.employee_id, E.last_name,
b. Limited to 2 relational tables E.first_name, D.department_name, E.salary*12 AS
"ANNUAL SALARY", D.location_id
c. Opposite FROM employees E 
d. Mutually Exclusive OUTER JOIN jobs J ON E.job_id = J.job_id
OUTER JOIN departments D ON E.department_id =
Question 24 D.department_id
Complete WHERE D.location_id = 1700 AND
Mark 4.00 out of 4.00 D.department_name = 'Finance' 
ORDER BY "ANNUAL SALARY" DESC

Flag question
PROG-113A-LAB-1812S / (47/50)► Week
Question text 10: Quarterly Examination / ► First Quarter
Display employee id, lastname, firstname, department Exam
name, annual salary, location id of employees whose
location id is 1700 and working in Finance Question 1
Department. Label the annual salary to ANNUAL Answer saved
Marked out of 1.00
SALARY. 
Sort the output in from highest to lowest salary. (4
POINTS)
Select one:
a. SELECT E.employee_id, E.last_name, Remove flag
E.first_name, D.department_name, E.salary*12 AS
"ANNUAL SALARY", D.location_id Question text
FROM employees E 
NATURAL JOIN jobs J ON E.job_id = J.job_id You can relate data to multiple tables using a foreign
NATURAL JOIN departments D ON E.department_id key.
= D.department_id Select one:
ORDER BY "ANNUAL SALARY" DESC
WHERE D.location_id = 1700 AND True
D.department_name = 'Finance'
False
b. SELECT E.employee_id, E.last_name,
E.first_name, D.department_name, E.salary*12 AS Question 2
"ANNUAL SALARY", D.location_id Answer saved
Marked out of 1.00
FROM employees E 
JOIN jobs J ON E.job_id = J.job_id
JOINemployees E ON E.department_id =
D.department_id
WHERE D.location_id = 1700 AND
Remove flag Flag question

Question text Question text


Which of the following SELECT statement is the What will be the SQL command if every employee will
correct report that will deduct 5 from ONHAND, be given a productivity bonus which is equivalent to
multiply 5 in WAREHOUSE, after getting the value on 3% of the monthly salary?
both ONHAND and WAREHOUSE add their data: as Display the employee id, salary and the productivity
shown below: ONHAND - 5 + 5 * WAREHOUSE bonus.
Note that you have to force the Oracle to prioritize first
the Subtraction over Multiplication. List only the Select one:
column DESCRIPTION, ONHAND and a. SELECT employee_id, salary, salary * .03
WAREHOUSE. FROM employees
Select one: b. SELECT employee_id, salary, salary * .30
a. SELECT (ONHAND-5) + 5(* WAREHOUSE), FROM employees
DESCRIPTION FROM PARTS; c. SELECT employee_id, salary, salary * 1.03
b. SELECT ONHAND-5 + 5 * WAREHOUSE, FROM employees
DESCRIPTION FROM PARTS; d. SELECT employee_id, salary, salary +
c. SELECT (ONHAND-5) + 5 * WAREHOUSE, (salary .03) FROM employees
DESCRIPTION FROM PARTS; e. SELECT employee_id, salary FROM
d. SELECT ONHAND-5 + 5 (* WAREHOUSE), employees WHERE salary)
DESCRIPTION FROM PARTS;
Question 5
Answer saved
Question 3
Marked out of 1.00
Answer saved
Marked out of 1.00

Flag question
Flag question Question text
Question text
You want to display the employee’s last name
INSERT, DELETE, UPDATE are ________________ whose salary is below 10,000 and whose lastname
commands starts with letter K. 
Select one: Which SQL statement give the required output
format of the salary? 
a. DCL
Select one:
b. DML
a. SELECT last_name, TO_CHAR(salary,
c. DDL '$999,999.99') AS "MONTHLY SALARY" FROM
d. All of the choices employees WHERE salary < 10000WHERE
last_name LIKE ‘K%’
Question 4
Answer saved
b. SELECT last_name, TO_NUMBER(salary,
Marked out of 1.00 '$999,999.99') AS "MONTHLY SALARY" FROM
employees WHERE salary < 10,000WHERE
last_name = ‘K%’
Question 8
c. SELECT last_name, TO_INTEGER(salary, Answer saved
$999,999.99) AS "MONTHLY SALARY" FROM Marked out of 1.00
employees WHERE salary < 10000 WHERE
last_name IN 'K%'
d. SELECT last_name, TO_INT(salary,
'$999,999.99') AS "MONTHLY SALARY" FROM
employees WHERE salary < 10,000 WHERE
last_name STARTS 'K%' Remove flag

Question text
Question 6
Answer saved You what to generate the average salary of all
Marked out of 1.00 employees whose job function is FI_ACCOUNT. 
Which of the following SQL command will produce the
output.
Select one:

Remove flag
a. SELECT AVG(salary) FROM employees
WHERE job_id = 'FI_ACCOUNT';
Question text
b. SELECT AVE(salary) FROM employees
Which of the following is the correct report that will WHERE job_id = 'FI_ACCOUNT';
display the CLASS from table PARTS.
c. SELECT AVERAGE(salary) FROM employees
Select one: WHERE job_id = 'FI_ACCOUNT';
a. SELECT * CLASS FROM PARTS; d. SELECT COUNT AVG(salary) FROM
employees WHERE job_id = 'FI_ACCOUNT';
b. SELECT CLASS AS CLASS FROM PARTS;
Question 9
c. SELECT 'CLASS' FROM PARTS; Answer saved
Marked out of 1.00
d. SELECT CLASS FROM PARTS;

Question 7
Answer saved
Marked out of 1.00

Remove flag

Question text
Evaluate the following SQL command
Remove flag SELECT employee_id, min_salary, max_salary
Question text FROM employees, departments WHERE
salary>= 10000 && salary <= 20000
Evaluate the following SQL command
SELECT employee_id, salary, department_id FROM Select one:
employees WHERE department_id IN (60,70) a. The SQL will produce Cartesian Product
Select one: b. The SQL will display the employee id,
a. The SQL command will display employees with department id and the minimum and maximum salary
department id 60 or 70. whose salary is between 10000 and 20000.

b. The SQL command will give an incorrect c. The SQL command will give an incorrect
output. output.

c. The SQL command will produce an error. d. The SQL command will produce an error.

d. The SQL command will display employees with Question 10


department id 60 and 70. Answer saved
Marked out of 1.00
Marked out of 1.00

Flag question
Flag question
Question text
Question text
You want to display the employee's last name whose
salary is below 10,000 and whose lastname starts What is the SQL command to display the date of the
with letter D.  first employee that was hired?
Which SQL statement give the required output format
Select one:
of the salary?
a. SELECT FIRST(hire_date) FROM employees;
Select one:
b. SELECT hire_date FROM employees WHERE
a. SELECT last_name, TO_INTEGER(salary,
TO_CHAR(hire_date) = ‘FIRST’;
$999,999.99) AS "MONTHLY SALARY" FROM
employees WHERE salary < 10000 WHERE c. SELECT MIN(hire_date) FROM employees;
last_name IN 'D%'
d. SELECT hire_date FROM employees WHERE
b. SELECT last_name, TO_INT(salary, FIRST(hire_date );
'$999,999.99') AS "MONTHLY SALARY" FROM
employees WHERE salary < 10,000 WHERE Question 13
last_name STARTS 'D%' Answer saved
Marked out of 1.00
c. SELECT last_name, TO_CHAR(salary,
'$999,999.99') AS "MONTHLY SALARY" FROM
employees WHERE salary < 10000 WHERE
last_name LIKE 'D%'
d. SELECT last_name, TO_NUMBER(salary,
Flag question
'$999,999.99') AS "MONTHLY SALARY" FROM
employees WHERE salary < 10,000 WHERE Question text
last_name = ‘D%’
You want to display the employee id and the year
Question 11 when an employee was hired. 
Answer saved Which SQL statement give the required output?
Marked out of 1.00
Select one:
a. SELECT employee_id,
YEAR(hire_date,'YYYY') FROM employees;
b. SELECT employee_id, YEAR(hire_date')
Flag question FROM employees;
Question text c. SELECT employee_id,
TO_YEAR(hire_date,'YYYY') FROM employees;
Which of the following will is the correct command to
create a role. d. SELECT employee_id,
TO_CHAR(hire_date,'YYYY') FROM employees;
Select one:
a. CREATE ROLE gen_manager Question 14
Answer saved
b. None of the choices Marked out of 1.00

c. GRANT ROLE gen_manager


d. CREATE gen_manager ROLE

Question 12
Answer saved Remove flag
Question text Question text
Evaluate the following SQL command TRUE OR FALSE.
SELECT employee_id, hire_date, department_name A FOREIGN KEY is a field in one table that refers to
FROM employees, departments the PRIMARY KEY in another table.
WHERE departments.department_id =
employees.department_id Select one:

Select one: True

a. The SQL command will produce an error. False

b. The SQL command will give an incorrect Question 17


output. Answer saved
Marked out of 1.00
c. The SQL command should have ALIAS for the
table to produce a correct output.
d. The SQL command will produce a correct
output.
Flag question
Question 15
Answer saved Question text
Marked out of 1.00
INDEX is an example of _____________________
privilege.
Select one:
a. System
Remove flag
b. None of the choices
Question text
c. Object
Display all the records whose stock is below 20 and in
warehouse number 3. d. Data
Select one: Question 18
Answer saved
a. SELECT * FROM parts WHERE onhand< 20 Marked out of 1.00
OR warehouse = 3;
b. SELECT * FROM parts WHERE onhand> 20
OR warehouse = 3;
c. SELECT * FROM parts WHERE onhand< 20
AND warehouse = 3; Flag question

d. SELECT * FROM parts WHERE onhand<= 20 Question text


AND warehouse = 3;
Ms. Ella what to generate the average salary of all
e. SELECT ALL FROM parts WHERE onhand< employees whose job function is IT_PROG. 
20 AND warehouse = 3; Which of the following SQL command will produce the
output.
f. SELECT ALL FROM parts WHERE onhand<=
20 AND warehouse = 3; Select one:

Question 16 a. SELECT AVERAGE(salary) FROM employees


Answer saved WHERE job_id = 'IT_PROG';
Marked out of 1.00
b. SELECT AVE(salary) FROM employees
WHERE job_id = 'IT_PROG';
c. SELECT AVG(salary) FROM employees
WHERE job_id = 'IT_PROG';

Flag question
Question text
d. SELECT COUNT AVG(salary) FROM
employees WHERE job_id = 'IT_PROG'; Display all the records in the employee table. Arrange
the output in by lastname from A-Z order.
Question 19
Answer saved Select one:
Marked out of 1.00
a. SELECT * FROM employees SORT BY
lastname
b. SELECT * FROM employees ORDER BY
lastname AZ
Flag question c. SELECT * FROM employees ORDER BY
lastname
Question text
d. SELECT * FROM employees SORT BY
A _______________ consists of a collection of DML lastname ascending
statements that form a logical unit of work.
Question 22
Select one:
Answer saved
Marked out of 1.00
a. All of the choices
b. Transaction
c. SQL command
d. Database
Flag question
Question 20
Question text
Answer saved
Marked out of 1.00
Austin David was transferred to Purchasing
Department. You are assigned to update the
database. 
Which of the following SQL command will satisfy the
requirements?
Remove flag Select one:
Question text a. UPDATE first_name = ‘David’ AND last_name
= ‘Austin’ FROM employees SET department_id = 30
Which of the following SELECT statement is the
correct PL/SQL that will display all rows and b. UPDATE employees SET department_id = 30
columns? WHERE first_name = ‘David’ AND last_name =
‘Austin’
Select one:
c. UPDATE department_id = 30 WHERE
a. SELECT TABLE PARTS; first_name = ‘David’ AND last_name = ‘Austin’
b. SELECT FROM TABLE PARTS; d. UPDATE employees WHERE department_id =
c. SELECT * FROM PARTS; 30 SET first_name = ‘David’ AND last_name =
‘Austin’
d. SELECT ALL FROM PARTS;
Question 23
Question 21 Answer saved
Answer saved Marked out of 1.00
Marked out of 1.00

Flag question
Remove flag
Question text
The General Manager request to the Database
Administrator to generate the total number of parts
and total outstanding balance on hand of every class
in warehouse number 1&2. 
Which of the following SQL command will generate
the required output. Flag question

Select one: Question text


a. SELECT warehouse, class, count(partnum), What privileges that manipulates the content of the
sum(onhand) GROUP BY warehouse,class HAVING database objects.
warehouse = 1 or warehouse = 2 FROM parts;
Select one:
b. SELECT warehouse, class, count(partnum),
sum(onhand) GROUP BY warehouse,class WHERE a. Object Privileges
warehouse = 1 or warehouse = 2 FROM parts; b. Connection Privileges
c. SELECT warehouse, class, SUM(partnum), c. Network Privileges
SUM(onhand) FROM parts GROUP BY
warehouse,class HAVING warehouse = 1 AND d. System Privileges
warehouse = 2;
Question 26
d. SELECT warehouse, class, COUNT(partnum), Answer saved
SUM(onhand) FROM parts GROUP BY Marked out of 1.00
warehouse,class HAVING warehouse = 1 OR
warehouse = 2;

Question 24
Answer saved
Marked out of 1.00
Remove flag

Question text
Each row of data in a table can be uniquely identified
by a
Flag question Select one:
Question text a. foreign key
John want to know how many employees receiving b. primary key
salary below 10,000.
What SQL command he need to run? c. local key
Select one: d. relational key
a. SELECT COUNT(salary) FROM employees e. index key
WHERE salary < 10,000;
Question 27
b. SELECT COUNT(*) FROM employees Answer saved
WHERE salary < 10000; Marked out of 1.00

c. SELECT salary FROM


COUNT(employees)WHERE salary < 10000;
d. SELECT COUNT(emp_id) FROM employees
WHERE salary <= 10000;
Flag question
Question 25
Answer saved
Question text
Marked out of 1.00
You want to display all the job position titles whose
salary is salary from 5,000 to 12,000 arrange from
highest to lowest
Select one:
a. SELECT job_title FROM employees WHERE b. SELECT last_name, hire_date FROM
salary >= 5000 AND salary <= 10000 employees WHERE hire_date >= TO_DATE('01-Jan-
2002', 'DD-Mon-RR') AND hire_date <=
b. SELECT employees_id, job_title FROM TO_DATE('31-Dec-2002', 'DD-Mon-RR') AND salary
employees WHERE salary >= 5000 AND salary <= > 5000;
10000
c. SELECT last_name, hire_date FROM
c. SELECT job_title FROM jobs WHERE salary employees WHERE hire_date >= TO_DATE('2000',
>= 5000 AND salary <= 10000 'YYYY') AND hire_date <= TO_DATE('2002', 'YYYY')
d. SELECT job_title FROM jobs WHERE OR salary > 5000;
min_salary >= 5000 AND max_salary<= 10000 d. SELECT last_name, hire_date FROM
employees WHERE hire_date >= TO_DATE('Jan-
Question 28
2000', 'Month-YYYY') AND hire_date <=
Answer saved
Marked out of 1.00 TO_DATE('Dec-2002', 'Month-‘YYYY') AND salary >
5,000;

Question 30
Answer saved
Marked out of 1.00

Remove flag

Question text
Display all location id between 1000 to 2000.
Flag question
Select one:
Question text
a. DISPLAY location_id FROM departments
WHERE location_id LING 1000 UP TO 2000 There was 10% price increase in the all the parts in
warehouse number 3. The Store Manager asked the
b. SELECT location_id FROM departments Database Administrator to generate a report showing
WHERE location_id IN 1000 AND 2000 the part number, the old and new price. 
c. DISPLAY location_id FROM departments Which of the following SQL statement would satisfy
WHERE location_id BETWEEN 1000 TO 2000 the requirement of the Store Manager.

d. SELECT location_id FROM departments Select one:


WHERE location_id BETWEEN 1000 AND 2000 a. SELECT partnum, price, price * 0.1 FROM
parts WHERE warehouse = 3
Question 29
Answer saved b. SELECT partnum, price, price * 10% FROM
Marked out of 1.00
parts WHERE warehouse = 3
c. SELECT partnum, price, price * 1.1 FROM
parts WHERE warehouse = 3
d. SELECT partnum, price, price * 1.10% FROM
Flag question
parts WHERE warehouse = 3

Question text Question 31


Answer saved
You want to display the employee's last name and Marked out of 1.00
date hired in year 2002 whose salary is above 5000.
Which SQL statement give the required output?
Select one:
a. SELECT last_name, hire_date FROM
employees WHERE hire_date >= TO_DATE('01-Jan- Remove flag
2000', 'DD-Mon-YYYYY') AND hire_date <= Question text
TO_DATE('31-Dec-2002', 'DD-Mon-YYYY')AND
salary ABOVE 5000;
You want to display the employee's last name and
date hired in year 2000 to2006 whose salary is above
5000. Which SQL statement give the required output?
Select one:
a. SELECT last_name, hire_date FROM Flag question
employees WHERE hire_date>=  Question text
TO_DATE('01-Jan-2000', 'DD-Mon-YYYYY') AND
hire_date<= TO_DATE('31-Dec-2006', 'DD-Mon- ANSI SQL commands cannot be abbreviated.
YYYY') AND salary ABOVE 5000;
Select one:
b. SELECT last_name, hire_date FROM
employees WHERE hire_date>=  True
TO_DATE('01-Jan-2006', 'DD-Mon-RR') AND False
hire_date<= TO_DATE('31-Dec-2006', 'DD-Mon-RR')
AND salary > 5000; Question 34
Answer saved
c. SELECT last_name, hire_date FROM Marked out of 1.00
employees WHERE hire_date>= 
TO_DATE('Jan-2000', 'Month-YYYY') AND
hire_date<= TO_DATE('Dec-2006', 'Month-‘YYYY')
AND salary > 5,000;
d. SELECT last_name, hire_date FROM
employees WHERE hire_date>=  Remove flag
TO_DATE('2000', 'YYYY') AND hire_date<= Question text
TO_DATE('2006', 'YYYY') OR salary > 5000;
Display the lastname of every employee in the
Question 32 company. Display the output in a single column and
Answer saved label it as Fullname
Marked out of 1.00
Format: JuanReyes
Select one:
a. SELECT CONCATENATE(first_name,
last_name) AS Fullname FROM employees
Remove flag b. None of the choices
Question text c. SELECT CONCAT(first_name, last_name)
Which of the following SQL commands will display all FROM employees
the stocks on hand from 10 to 30? d. SELECT CONCAT(first_name, last_name) AS
Select one: Fullname FROM employees

a. SELECT * FROM parts WHERE BETWEEN Question 35


onhand = 10 AND onhand = 30; Answer saved
Marked out of 1.00
b. SELECT * FROM parts WHERE onhand
BETWEEN 10 to 30;
c. SELECT * FROM onhand WHERE parts
BETWEEN onhand = 10 AND onhand = 30;
d. SELECT * FROM parts WHERE onhand Remove flag
BETWEEN 10 AND 30; Question text
e. SELECT * FROM parts WHERE BETWEEN Evaluate the following SQL command
onhand>=10 to onhand<=30; SELECT * FROM jobs WHERE job_title LIKE
'Manager%'
Question 33
Answer saved Select one:
Marked out of 1.00
a. The SQL command will display all records in b. SELECT employee_id, hire_date,
the database TO_DATE(hire_date,'Month') AS "Hired Month",
job_id FROM
b. The SQL command will display all employees
with Manager position c. SELECT employee_id, hire_date,
MONTH(hire_date,'Month') AS "Hired Month", job_id
c. No records will be displayed FROM employees
d. The SQL command will produce an error. d. SELECT employee_id, hire_date,
TO_CHAR(hire_date,'Month') AS "Hired Month",
Question 36
job_id FROM employees
Answer saved
Marked out of 1.00
Question 38
Answer saved
Marked out of 1.00

Flag question

Question text
Flag question
Aldrin wants to know the highest salary in every
department. Which of the following SQL command will Question text
display the required output? Which of the following describes the command
Select one: below? 
SELECT * FROM employees WHERE department =
a. SELECT department_id, HIGH(salary) FROM 60 FOR UPDATE
employees GROUP BY department_id AND salary;
Select one:
b. SELECT department_id, HIGHEST(salary)
FROM employees GROUP BY salary; a. Locks the rows in the EMPLOYEES table with
department id is 60.
c. SELECT department_id, MAX(salary) FROM
employees GROUP BY department_id b. Unlock all records with department id = 60

d. SELECT department_id, MAXIMUM(salary) c. All users accessing the department id 60 can


FROM employees GROUP BY department_id; accept UPDATE command simultaneously.
d. Creates a temporary table with department =
Question 37
60
Answer saved
Marked out of 1.00
Question 39
Answer saved
Marked out of 1.00

Remove flag

Question text
Flag question
You want to display all the employee id and the month
an employee was hired. Question text
Which SQL statement give the required output? Display the employee id, number of years and the
Select one: hiring date of every employee in the company.

a. SELECT employee_id, hire_date, Select one:


TO_MONTH(hire_date,'Month') AS "Hired Month", a. SELECT employee_id, hire_date,
job_id FROM employees ROUND((SYSDATE - hire_date),0 /365,0) FROM
employees;
b. SELECT employee_id, hire_date, c. SELECT class, sum(onhand) AS "QTY ON
ROUND((SYSDATE - hire_date) /365,0) FROM HAND" FROM parts GROUP BY onhand
employees;
d. SELECT class, sum(onhand) AS "QTY ON
c. SELECT employee_id, hire_date, hire_date HAND" FROM parts GROUP BY class
/365 FROM employees;
Question 42
d. SELECT employee_id, hire_date, hire_date- Answer saved
SYSDATE /365 FROM employees; Marked out of 1.00

Question 40
Answer saved
Marked out of 1.00

Remove flag

Question text

Flag question
Display the first 5 letter in the surname of all the
employees whose firstname starts with letter 'N'
Question text
Select one:
The DBA will create a new user name sales. 
Which of the following SQL command will perform the a. SELECT SUBSTR(last_name,1,5), first_name
creation? FROM employees WHERE SUBSTR(first_name,1,1)
IN 'N'
Select one:
b. SELECT SUBSTR(last_name,1,5), first_name
a. CREATE USER FR0M DB_USER SET FROM employees WHERE SUBSTR(first_name,1,1)
user=’sales’ password=NULL = 'N'
b. None of the choices c. SELECT SUBSTR(surname,1,5), first_name
FROM employees WHERE first_name = 'N'
c. CREATE USERNAME sales SET PASSWORD
default d. SELECT SUBSTR(surname,1,5), first_name
FROM employees WHERE SUBSTR(first_name,1,1)
d. CREATE sales ACCESS 1234 IN 'N'
e. CREATE USER sales IDENTIFIED BY 1234 e. SELECT SUBSTR(last_name,1,5), first_name
FROM employees WHERE first_name IN 'N'
Question 41
Answer saved
Question 43
Marked out of 1.00
Answer saved
Marked out of 1.00

Flag question

Question text Flag question

Which of the following SQL command will display the Question text
summary table showing the total quantity on hand per Display the employee id, salary, number of years and
class. the hiring date of every employee in the company.
Select one: Select one:
a. SELECT class, TOTAL(onhand) AS "QTY ON a. SELECT employee_id,salary, hire_date,
HAND" FROM parts GROUP BY class, onhand hire_date- SYSDATE /365 FROM employees;
b. SELECT class, onhand AS "QTY ON HAND" b. SELECT employee_id, salary, hire_date,
FROM parts GROUP BY sum(onhand) hire_date /365 FROM employees;
job_id FROM employees WHERE job_id NOT =
c. SELECT employee_id, salary, hire_date, 'AD_VP';
ROUND((SYSDATE - hire_date) /365,0) FROM
employees; Question 46
Answer saved
Question 44 Marked out of 1.00
Answer saved
Marked out of 1.00

Remove flag

Flag question Question text


Question text Display employee's name and id whose firstname
starts with letter D and job id is IT_PROG. 
True or False. The AND, OR, NOT are comparison Sort the output by department.
operators.
Select one:
Select one:
a. SELECT employees FROM employee_id,
True first_name, last_name WHERE first_name LIKE ‘D%’
False and job_id = ‘IT_PROG’ ORDER BY department_id
b. SELECT employee_id, first_name, last_name
Question 45
FROM employees WHERE job_id = 'IT_PROG' OR
Answer saved
Marked out of 1.00 first_name LIKE 'D%' and ORDER BY department_id
c. SELECT employee_id, first_name, last_name
FROM employees ORDER BY department_id
WHERE first_name LIKE 'D%' and job_id =
'IT_PROG'
Flag question d. SELECT employee_id, first_name, last_name
FROM employees WHERE first_name LIKE 'D%' and
Question text job_id = 'IT_PROG' ORDER BY department_id
You want to display all the employee id and the month
Question 47
an employee was hired excluding employees whose
Answer saved
job id is AD_VP. Which SQL statement give the Marked out of 1.00
required output?
Select one:
a. SELECT employee_id, hire_date,
MONTH(hire_date,'Month') AS "Hired Month",
job_id  FROM employees WHERE job_id EXCLUDE Flag question

('AD_VP'); Question text


b. SELECT employee_id, hire_date, TRUE OR FALSE.
TO_CHAR(hire_date,'Month') AS "Hired Month", An owner has all the privileges on the object.
job_id FROM employees WHERE job_id NOT IN
('AD_VP'); Select one:

c. SELECT employee_id, hire_date, True


TO_MONTH(hire_date,'Month') AS "Hired Month", False
job_id FROM employees WHERE job_id NOT
('AD_VP'); Question 48
Answer saved
d. SELECT employee_id, hire_date, Marked out of 1.00
TO_DATE(hire_date,'Month') AS "Hired Month",
Flag question Flag question

Question text Question text


You want to generate the total salary per month of What is the SQL command to count the number of
every department in the company. records in the employees table?
Select one: Select one:
a. SELECT department_id, SUM(salary) FROM a. SELECT ALL FROM employees
employees GROUP BY department_id
b. SELECT * FROM employees;
b. SELECT department_id, salary FROM
employees ORDER BY SUM(salary) c. SELECT COUNT(*) FROM employees

c. SELECT department_id, salary FROM d. SELECT SUM(*) FROM employees;


employees GROUP BY SUM(salary) ORDER BY
department_id
Question 1
d. SELECT department_id, TOTAL(salary) FROM Complete
employees GROUP BY department_id Mark 2.00 out of 2.00
Flag question
Question 49
Answer saved Question text
Marked out of 1.00
You want to display all the job position titles whose
salary is salary from 5,000 to 12,000 arrange from
highest to lowest
Select one:
a. SELECT job_title FROM jobs WHERE min_salary >=
Flag question 5000 AND max_salary<= 10000
Question text b. SELECT job_title FROM employees WHERE salary >=
5000 AND salary <= 10000
Which of the following SQL commands will display all c. SELECT employees_id, job_title FROM employees
stocks whose class is HW or AP. WHERE salary >= 5000 AND salary <= 10000
d. SELECT job_title FROM jobs WHERE salary >= 5000
Select one: AND salary <= 10000
a. SELECT * FROM parts WHERE IN (class =
Question 2
‘HW’, class= ‘AP’);
Complete
Mark 2.00 out of 2.00
b. SELECT ALL FROM class WHERE parts IN = Flag question
(‘HW’, ‘AP’);
Question text
c. SELECT * FROM parts WHERE IN class
('HW', 'AP'); What is the SQL command to count the number of
records in the employees table?
d. SELECT ALL FROM parts WHERE IN class =
(‘HW’, ‘AP’); Select one:
a. SELECT ALL FROM employees
e. SELECT * FROM parts WHERE class IN b. SELECT * FROM employees;
('HW', 'AP'); c. SELECT COUNT(*) FROM employees
d. SELECT SUM(*) FROM employees;
Question 50
Answer saved
Question 3
Marked out of 1.00
Complete
Mark 2.00 out of 2.00
Flag question
Question text a. SELECT department_id, salary FROM employees
ORDER BY SUM(salary)
True or False. The AND, OR, NOT are comparison b. SELECT department_id, TOTAL(salary) FROM
operators. employees GROUP BY department_id
Select one: c. SELECT department_id, salary FROM employees
True GROUP BY SUM(salary) ORDER BY department_id
False d. SELECT department_id, SUM(salary) FROM
employees GROUP BY department_id
Question 4
Complete Question 7
Mark 2.00 out of 2.00 Complete
Flag question Mark 2.00 out of 2.00
Flag question
Question text
Question text
Evaluate the following SQL command
SELECT * FROM jobs WHERE job_title LIKE You want to display the employee's last name whose
'Manager%' salary is below 10,000 and whose lastname starts
with letter D. 
Select one: Which SQL statement give the required output format
a. The SQL command will produce an error. of the salary?
b. The SQL command will display all employees with
Manager position Select one:
c. The SQL command will display all records in the a. SELECT last_name, TO_INT(salary, '$999,999.99') AS
database "MONTHLY SALARY" FROM employees WHERE
d. No records will be displayed salary < 10,000 WHERE last_name STARTS 'D%'
b. SELECT last_name, TO_CHAR(salary, '$999,999.99')
Question 5 AS "MONTHLY SALARY" FROM employees WHERE
Complete salary < 10000 WHERE last_name LIKE 'D%'
Mark 2.00 out of 2.00 c. SELECT last_name, TO_INTEGER(salary,
Flag question $999,999.99) AS "MONTHLY SALARY" FROM
Question text employees WHERE salary < 10000 WHERE
last_name IN 'D%'
You want to display all the employee id and the month d. SELECT last_name, TO_NUMBER(salary,
an employee was hired. '$999,999.99') AS "MONTHLY SALARY" FROM
Which SQL statement give the required output? employees WHERE salary < 10,000 WHERE
last_name = ‘D%’
Select one:
a. SELECT employee_id, hire_date, Question 8
TO_DATE(hire_date,'Month') AS "Hired Month", Complete
job_id FROM Mark 2.00 out of 2.00
b. SELECT employee_id, hire_date, Flag question
MONTH(hire_date,'Month') AS "Hired Month", job_id Question text
FROM employees
c. SELECT employee_id, hire_date, Display the lastname of every employee in the
TO_CHAR(hire_date,'Month') AS "Hired Month", company. Display the output in a single column and
job_id FROM employees label it as Fullname
d. SELECT employee_id, hire_date, Format: JuanReyes
TO_MONTH(hire_date,'Month') AS "Hired Month",
job_id FROM employees Select one:
a. None of the choices
Question 6 b. SELECT CONCATENATE(first_name, last_name) AS
Complete Fullname FROM employees
Mark 2.00 out of 2.00 c. SELECT CONCAT(first_name, last_name) FROM
Flag question employees
Question text d. SELECT CONCAT(first_name, last_name) AS
Fullname FROM employees
You want to generate the total salary per month of
every department in the company. Question 9
Complete
Select one: Mark 0.00 out of 2.00
Flag question
Question text Flag question

Display the first 5 letter in the surname of all the Question text
employees whose firstname starts with letter 'N'
Evaluate the following SQL command
Select one: SELECT employee_id, salary, department_id FROM
a. SELECT SUBSTR(last_name,1,5), first_name FROM employees WHERE department_id IN (60,70)
employees WHERE first_name IN 'N'
Select one:
b. SELECT SUBSTR(last_name,1,5), first_name FROM
a. The SQL command will produce an error.
employees WHERE SUBSTR(first_name,1,1) = 'N'
b. The SQL command will display employees with
c. SELECT SUBSTR(surname,1,5), first_name FROM
department id 60 and 70.
employees WHERE SUBSTR(first_name,1,1) IN 'N'
c. The SQL command will give an incorrect output.
d. SELECT SUBSTR(surname,1,5), first_name FROM
d. The SQL command will display employees with
employees WHERE first_name = 'N'
department id 60 or 70.
e. SELECT SUBSTR(last_name,1,5), first_name FROM
employees WHERE SUBSTR(first_name,1,1) IN 'N' Question 13
Complete
Question 10 Mark 2.00 out of 2.00
Complete Flag question
Mark 2.00 out of 2.00
Flag question Question text
Question text You want to display the employee's last name and
date hired in year 2000 to2006 whose salary is above
Austin David was transferred to Purchasing
5000. Which SQL statement give the required output?
Department. You are assigned to update the
database.  Select one:
Which of the following SQL command will satisfy the a. SELECT last_name, hire_date FROM employees
requirements? WHERE hire_date>= 
TO_DATE('01-Jan-2006', 'DD-Mon-RR') AND
Select one:
hire_date<= TO_DATE('31-Dec-2006', 'DD-Mon-RR')
a. UPDATE first_name = ‘David’ AND last_name =
AND salary > 5000;
‘Austin’ FROM employees SET department_id = 30
b. SELECT last_name, hire_date FROM employees
b. UPDATE department_id = 30 WHERE first_name =
WHERE hire_date>= 
‘David’ AND last_name = ‘Austin’
TO_DATE('Jan-2000', 'Month-YYYY') AND
c. UPDATE employees WHERE department_id = 30 SET
hire_date<= TO_DATE('Dec-2006', 'Month-‘YYYY')
first_name = ‘David’ AND last_name = ‘Austin’
AND salary > 5,000;
d. UPDATE employees SET department_id = 30 WHERE
c. SELECT last_name, hire_date FROM employees
first_name = ‘David’ AND last_name = ‘Austin’
WHERE hire_date>= 
Question 11
TO_DATE('01-Jan-2000', 'DD-Mon-YYYYY') AND
Complete hire_date<= TO_DATE('31-Dec-2006', 'DD-Mon-
Mark 2.00 out of 2.00 YYYY') AND salary ABOVE 5000;
Flag question d. SELECT last_name, hire_date FROM employees
WHERE hire_date>= 
Question text
TO_DATE('2000', 'YYYY') AND hire_date<=
John want to know how many employees receiving TO_DATE('2006', 'YYYY') OR salary > 5000;
salary below 10,000.
What SQL command he need to run? Question 14
Complete
Select one: Mark 2.00 out of 2.00
Flag question
a. SELECT COUNT(*) FROM employees WHERE salary
< 10000; Question text
b. SELECT COUNT(salary) FROM employees WHERE
salary < 10,000; List all employees except for IT_PROG job id.
c. SELECT COUNT(emp_id) FROM employees WHERE
Select one:
salary <= 10000;
a. SELECT *FROM employees EXCEPT JOB_ID !=
d. SELECT salary FROM COUNT(employees)WHERE
'IT_PROG'
salary < 10000;
b. SELECT *FROM employees WHERE JOB_ID NOT IN
Question 12
('IT_PROG')
Complete c. SELECT *FROM employees WHERE JOB_ID <>
Mark 2.00 out of 2.00 'IT_PROG'
d. All of the choices Question 18
Complete
Question 15 Mark 2.00 out of 2.00
Complete Flag question
Mark 2.00 out of 2.00
Flag question Question text
Question text You what to generate the average salary of all
employees whose job function is FI_ACCOUNT. 
Evaluate the following SQL command Which of the following SQL command will produce the
SELECT employee_id, min_salary, max_salary output.
FROM employees, departments WHERE
salary>= 10000 && salary <= 20000 Select one:
a. SELECT AVERAGE(salary) FROM employees WHERE
Select one: job_id = 'FI_ACCOUNT';
a. The SQL will produce Cartesian Product b. SELECT AVG(salary) FROM employees WHERE
b. The SQL will display the employee id, department id job_id = 'FI_ACCOUNT';
and the minimum and maximum salary whose salary c. SELECT AVE(salary) FROM employees WHERE
is between 10000 and 20000. job_id = 'FI_ACCOUNT';
c. The SQL command will produce an error. d. SELECT COUNT AVG(salary) FROM employees
d. The SQL command will give an incorrect output. WHERE job_id = 'FI_ACCOUNT';
Question 16 Question 19
Complete Complete
Mark 2.00 out of 2.00 Mark 2.00 out of 2.00
Flag question Flag question
Question text Question text
Display all the records in the employee table. Arrange Display all location id between 1000 to 2000.
the output in by lastname from A-Z order.
Select one:
Select one: a. DISPLAY location_id FROM departments WHERE
a. SELECT * FROM employees SORT BY lastname location_id LING 1000 UP TO 2000
b. SELECT * FROM employees ORDER BY lastname b. DISPLAY location_id FROM departments WHERE
c. SELECT * FROM employees ORDER BY lastname AZ location_id BETWEEN 1000 TO 2000
d. SELECT * FROM employees SORT BY lastname c. SELECT location_id FROM departments WHERE
ascending location_id IN 1000 AND 2000
d. SELECT location_id FROM departments WHERE
Question 17
Complete
location_id BETWEEN 1000 AND 2000
Mark 2.00 out of 2.00
Flag question Question 20
Complete
Question text Mark 2.00 out of 2.00
Flag question
Display employee's name and id whose firstname
starts with letter D and job id is IT_PROG.  Question text
Sort the output by department. What will be the SQL command if every employee will
Select one: be given a productivity bonus which is equivalent to
a. SELECT employee_id, first_name, last_name FROM 3% of the monthly salary?
employees ORDER BY department_id WHERE Display the employee id, salary and the productivity
first_name LIKE 'D%' and job_id = 'IT_PROG' bonus.
b. SELECT employees FROM employee_id, first_name, Select one:
last_name WHERE first_name LIKE ‘D%’ and job_id a. SELECT employee_id, salary, salary + (salary .03)
= ‘IT_PROG’ ORDER BY department_id FROM employees
c. SELECT employee_id, first_name, last_name FROM b. SELECT employee_id, salary, salary * .03 FROM
employees WHERE job_id = 'IT_PROG' OR employees
first_name LIKE 'D%' and ORDER BY department_id c. SELECT employee_id, salary, salary * 1.03 FROM
d. SELECT employee_id, first_name, last_name FROM employees
employees WHERE first_name LIKE 'D%' and job_id d. SELECT employee_id, salary FROM employees
= 'IT_PROG' ORDER BY department_id WHERE salary)
e. SELECT employee_id, salary, salary * .30 FROM Question 23
employees Complete
Mark 2.00 out of 2.00
Question 21 Flag question
Complete
Mark 2.00 out of 2.00 Question text
Flag question
In creating Joins,the NATURALJOIN and USING
Question text clauses are____________
Display the employee id, salary, number of years and Select one:
the hiring date of every employee in the company. a. Mutually Inclusive
b. Limited to 2 relational tables
Select one: c. Opposite
a. SELECT employee_id,salary, hire_date, hire_date- d. Mutually Exclusive
SYSDATE /365 FROM employees;
b. SELECT employee_id, salary, hire_date, Question 24
ROUND((SYSDATE - hire_date) /365,0) FROM Complete
employees; Mark 4.00 out of 4.00
c. SELECT employee_id, salary, hire_date, hire_date Flag question
/365 FROM employees; Question text
Question 22 Display employee id, lastname, firstname, department
Complete name, annual salary, location id of employees whose
Mark 2.00 out of 2.00
Flag question
location id is 1700 and working in Finance
Department. Label the annual salary to ANNUAL
Question text SALARY. 
Sort the output in from highest to lowest salary. (4
Display the employee's name, job title, job_id and the POINTS)
department name of employees with department id of
100. Select one:
a. SELECT E.employee_id, E.last_name, E.first_name,
Select one: D.department_name, E.salary*12 AS "ANNUAL
a. SELECT E.employee_id, J.job_title, e.job_id, SALARY", D.location_id
D.department_name FROM employees E 
FROM employees E  NATURAL JOIN jobs J ON E.job_id = J.job_id
JOIN jobs J ON E.job_id = J.job_id NATURAL JOIN departments D ON E.department_id
JOIN departments D ON E.department_id = = D.department_id
D.department_id ORDER BY "ANNUAL SALARY" DESC
WHERE E.department_id = 100 WHERE D.location_id = 1700 AND
b. SELECT E.employee_id, J.job_title, e.job_id, D.department_name = 'Finance'
D.department_name b. SELECT E.employee_id, E.last_name, E.first_name,
FROM employees E  D.department_name, E.salary*12 AS "ANNUAL
JOIN department D ON E.job_id = J.job_id SALARY", D.location_id
JOIN jobs J ON E.department_id = D.department_id FROM employees E 
WHERE E.department_id = 100 JOIN jobs J ON E.job_id = J.job_id
c. SELECT E.employee_id, J.job_title, e.job_id, JOINemployees E ON E.department_id =
D.department_name D.department_id
FROM jobs J WHERE D.location_id = 1700 AND
INNER JOIN department D ON E.job_id = J.job_id D.department_name = 'Finance' 
INNER JOIN employees EON E.department_id = ORDER BY "ANNUAL SALARY" DESC
D.department_id c. SELECT E.employee_id, E.last_name, E.first_name,
WHERE E.department_id = 100 D.department_name, E.salary*12 AS "ANNUAL
d. SELECT E.employee_id, J.job_title, e.job_id, SALARY", D.location_id
D.department_name FROM employees E 
FROM jobs J JOIN jobs J ON E.job_id = J.job_id
NATURAL JOIN department D ON E.job_id = J.job_id JOIN departments D ON E.department_id =
NATURAL JOIN employees E ON E.department_id = D.department_id
D.department_id WHERE D.location_id = 1700 AND
WHERE E.department_id = 100 D.department_name = 'Finance' 
ORDER BY "ANNUAL SALARY" DESC
d. SELECT E.employee_id, E.last_name, E.first_name, SELECT * FROM parts WHERE onhand< 20 AND
D.department_name, E.salary*12 AS "ANNUAL warehouse = 3;
SALARY", D.location_id
FROM employees E  Ronnie is the stockman in the warehouse of ATR
OUTER JOIN jobs J ON E.job_id = J.job_id
Corporation. The General Manager wants to know the
OUTER JOIN departments D ON E.department_id =
D.department_id parts whose price is above 10000 and above. Which of
WHERE D.location_id = 1700 AND the following SQL command that Ronnie will run to
D.department_name = 'Finance'  generate the list.
ORDER BY "ANNUAL SALARY" DESC SELECT * FROM parts WHERE price >= 10000;

Which of the following SQL command will display all


records with class code of AP?
SELECT * FROM parts WHERE class = ‘AP’;

Which of the following SQL commands will display all


stocks whose class is HW or AP.
SELECT * FROM parts WHERE IN class ('HW', 'AP');
LA2

Display the name, jobs id and salary of the all the


employees whose department id is 100 and salary is ----------------------------------------
below 8000. Arrange the output by salary in ascending LA3
order.
SELECT first_name, last_name, salary FROM
employees WHERE department_id = 100 AND salary < Display the first 5 letter in the surname of all the
8000 ORDER BY salary employees whose firstname starts with letter 'D'
SELECT SUBSTR(last_name,1,5), first_name FROM
Display employee's name and id whose firstname starts employees WHERE SUBSTR(first_name,1,1) = 'D'
with letter D and job id is SA_REP. Sort the output by
department. Display the employee id, number of years and the hiring
SELECT employee_id, first_name, last_name FROM date of every employee in the company.
employees WHERE first_name LIKE 'D%' and job_id = SELECT employee_id, hire_date, ROUND((SYSDATE -
'IT_PROG' ORDER BY department_id hire_date) /365,0) FROM employees;

List all the employee_id of all employees whose salary is Every employee will get a bonus of 150% of his/her
5000 and below and belong to department 60 or 100. current salary. Display the employee id, salary and the
SELECT employee_id,salary, department_id FROM bonus of every employee. Label the computed bonus
employees WHERE salary < 5000 AND department_id with Bonus
IN (60,100) The correct answer is: SELECT employee_id, salary,
salary * 1.5 AS Bonus FROM employees

---------------------------------------- ----------------------------------------
SQ2 SQ3

Display all the records sorted by price from most Display the montly salary of every employee. Round the
expensive to the cheapest parts. salary in 2 decimal places.
SELECT * FROM parts ORDER BY price DESC SELECT ROUND( (salary/12),2 ) FROM employees;

Display all the records whose stock is below 20 and in Display the total number of characters of the last name
warehouse number 3. of all the employees.
SELECT LENGTH(last_name) FROM employees; id is AD_VP. Which SQL statement give the required
output?
Display the first 3 letter in the first name of all the SELECT employee_id, hire_date,
employees. TO_CHAR(hire_date,'Month') AS "Hired Month",
SELECT SUBSTR(first_name,1,3) FROM employees; job_id FROM employees WHERE job_id NOT IN
('AD_VP');
Display the last day of the month and the hiring date
when the employees are hired in the company. You want to display the employee's id and formatted
SELECT LAST_DAY(hire_date), hire_date FROM date hired as shown below.
employees; Which SQL statement give the required output?
Required output :
---------------------------------------- SELECT employee_id, TO_CHAR(hire_date, 'fmMonth
LA4 DD, YYYY') AS "Hired Date" FROM employees;

----------------------------------------
You want to display the employee id and the year when LA5
an employee was hired.
Which SQL statement give the required output?
SELECT employee_id, TO_CHAR(hire_date,'YYYY') The General Manager request to the Database
FROM employees; Administrator to generate the total salary per month of
every department in the company.
You want to display the employee id and the month an SELECT department_id, SUM(salary) FROM employees
employee was hired. GROUP BY department_id
Which SQL statement give the required output?
SELECT employee_id, hire_date, Ms. Ella what to generate the average salary of all
TO_CHAR(hire_date,'Month') AS "Hired Month" FROM employees whose job function is IT_PROG.
employees; Which of the following SQL command will produce the
output.
You want to display the employee's last name whose SELECT AVG(salary) FROM employees WHERE job_id =
salary is below 10,000. 'IT_PROG';
Which SQL statement give the required output format
of the salary? Aldrin wants to know the highest salary in every
Required output : department. Which of the following SQL command will
SELECT last_name, TO_CHAR(salary, '$999,999.99') AS display the required output?
"MONTHLY SALARY" FROM employees WHERE salary < SELECT department_id, MAX(salary) FROM employees
10000 GROUP BY department_id

What is the SQL command to display the date of the


first employee that was hired?
---------------------------------------- SELECT MIN(hire_date) FROM employees;
SQ4
John want to know how many employees receiving
salary below 10,000. What SQL command he need to
run?
SELECT COUNT(*) FROM employees WHERE salary <
You want to display the last name and the year when an 10000;
employee was hired whose job id is IT_PROG.
Which SQL statement give the required output? ----------------------------------------
SELECT last_name, TO_CHAR(hire_date,'YYYY') FROM LQ1
employees WHERE job_id = ‘IT_PROG’;

You want to display all the employee id and the month John want to know how many part items are there in
an employee was hired excluding employees whose job warehouse number 3.
What SQL command he need to run? (job_id);
SELECT COUNT(*) FROM parts WHERE warehouse = 3;

Which of the following SQL command will display all What will be the output of the SQL command below?
records with part number contains the number 9? SELECT first_name, last_name, job_title FROM
SELECT * from parts WHERE partnum LIKE '%9%' employees CROSS JOIN jobs ORDER BY last_name;
A Cartesian product

What will be the output of the following SQL? What will be the output of the SQL command below?
SELECT * FROM parts WHERE (warehouse = 1 or SELECT last_name, job_id, job_title FROM employees
warehouse = 2) AND class IN ('HW', 'AP') AND (price > NATURAL JOIN jobs
200 AND price < 500); List of names and job title of matched records from the
2 rows returned employees and jobs table

----------------------------------------
What will be the output of the SQL command? SQ6
SELECT SUM(onhand) FROM PARTS where class = 'HW'
OR class = 'AP' AND warehouse = 1;
137 Given the SQL command
SELECT * FROM employees JOIN departments USING
There was 10% price increase in the all the parts in (department_id)
warehouse number 3. The Store Manager asked the Which of the following describes the SQL command?
Database Administrator to generate a report showing Joined table from the employees and department
the part number, the old and new price. table
Which of the following SQL statement would satisfy the
requirement of the Store Manager.
SELECT partnum, price, price * 1.1 FROM parts WHERE Display the location id of all employee's name and
warehouse = 3 salary whose salary is from 5000 to 10000.
SELECT first_name, last_name, salary FROM
Which of the following SQL command will display the employees JOIN departments USING (department_id)
summary table showing the total quantity on hand per WHERE salary >= 5000 AND salary <= 10000
class.
SELECT class, sum(onhand) AS "QTY ON HAND" FROM Display the manager id and employee id of every
parts GROUP BY class employee
SELECT E.employee_id, D.manager_id FROM
employees E JOIN departments D ON E.department_id
Aldrin wants to know the outstanding total balance on = D.department_id
hand on every class per warehouse.
SELECT warehouse, class, sum(onhand) FROM parts Given the SQL command
GROUP BY warehouse, class SELECT employees.first_name, employees.last_name,
employees.salary,departments.department_name
---------------------------------------- FROM employees, departments
LA6 WHERE employees.department_id =
departments.department_id;
Which of the following describes the SQL command?
List of employees name, salary and department name

The HR Manager instruct the Database Officer to display ----------------------------------------


employee's name and the minimum and maximum LA7
salary the employee can received. Which of the
following SQL command will generate the output?
SELECT first_name, last_name, job_id, min_salary, Remove the Shareholder Services department in the
max_salary FROM employees JOIN jobs USING department table
DELETE FROM departments WHERE department_name
= ‘Shareholder Services’ SQL command to create a marker in the current
transaction.
SAVEPOINT
A new department name Training with department id
300 was created in the company. This will be managed Nathaniel had accidentally deleted all the records in the
by a Manager with ID of 203 and will located at location newly updated ORACLE database using the DELETE SQL
id 2400. command. What is the best solution that he can do to
Create a SQL command to update the information in the restore all the deleted records in the database.
department table. Run the ROLLBACK command
INSERT INTO departments VALUES (300, 'Training',
203, 2400) ----------------------------------------
LA8
Create a SQL command to add a new position Database
Administrator with job id of DB_ADMIN whose salary Which of the following will grant a query privileges on
ranges from 10,000 to 18,000. the STUDENT table
INSERT INTO jobs VALUES ('DB_ADMIN', 'Database GRANT select ON student TO matt
Administrator', 10000, 18000)
You want to cancel the privilege of matt to add records
Remove all Manager positions in the department table. from the employees table.
DELETE FROM jobs WHERE job_title LIKE '%Manager%'; REVOKE insert ON employees FROM matt;
----------------------------------------
SQ7 This has the highest level of privileges for task such as
creating new users, removing users and tables and
backing up tables.
DBA
Create a SQL command to add a new position Java
Developer with job id of JAVA_DEV whose salary ranges
from 7,000 to 8,000. ----------------------------------------
INSERT INTO jobs VALUES ('JAVA_DEV', 'Java SQ8
Developer', 7000, 8000)

TRUE OR FALSE.
Add a 500 pesos increase in salary of all employees who An owner has all the privileges on the object.
have rendered services 10 years and above. True
UPDATE employees SET salary = salary + 500 where
TO_CHAR(sysdate,'YYYY') - TO_CHAR(hire_date,'YYYY') Which of the following provide privilege to update the
>= 10 employees table?
GRANT update (salary) ON employees TO matt

Which of the following DOES NOT describes the state of Which of the following will is the correct command to
the data after the COMMIT command create a role.
None of the choices CREATE ROLE gen_manager

Which of the following describes the command below? Matt wants to change his password from 1234 to abcd.
SELECT * FROM employees WHERE department = 60 Which of the following will perform the task?
FOR UPDATE ALTER USER matt IDENTIFIED abcd;
Locks the rows in the EMPLOYEES table with
department id is 60. The DBA will create a new user name sales.
Which of the following SQL command will perform the
Which of the following will erase all records in the creation?
departments table CREATE sales ACCESS 1234
TRUNCATE TABLE departments
Which of the following SQL command that the DBA will
run to provide Matt to create a table in the Oracle You want to display all the job position titles whose
Database. salary is salary from 5,000 to 12,000 arrange from
GRANT create table TO matt highest to lowest
SELECT job_title FROM jobs WHERE min_salary >=
5000 AND max_salary<= 10000
What privileges that manipulates the content of the
database objects. List all employees except for IT_PROG job id.
Object Privileges All of the choices

Austin David was transferred to Purchasing


Department. You are assigned to update the database.
Which of the following SQL command will satisfy the
---------------------------------------- requirements?
1st Q Exam UPDATE employees SET department_id = 30 WHERE
first_name = ‘David’ AND last_name = ‘Austin’

Evaluate the following SQL command Display the lastname of every employee in the
SELECT employee_id, salary, department_id FROM company. Display the output in a single column and
employees WHERE department_id IN (60,70) label it as Fullname
The SQL command will display employees with Format: JuanReyes
department id 60 or 70. SELECT CONCAT(first_name, last_name) AS Fullname
FROM employees
True or False. The AND, OR, NOT are comparison
operators. Evaluate the following SQL command
False SELECT * FROM jobs WHERE job_title LIKE 'Manager%'
No records will be displayed
What is the SQL command to count the number of
records in the employees table?
SELECT COUNT(*) FROM employees Display all the records in the employee table. Arrange
the output in by lastname from A-Z order.
SELECT * FROM employees ORDER BY lastname
What will be the SQL command if every employee will
be given a productivity bonus which is equivalent to 3% You want to generate the total salary per month of
of the monthly salary? every department in the company.
Display the employee id, salary and the productivity SELECT department_id, SUM(salary) FROM employees
bonus. GROUP BY department_id
SELECT employee_id, salary, salary * .03 FROM
employees You want to display the employee's last name whose
salary is below 10,000 and whose lastname starts with
Display the employee id, salary, number of years and letter D.
the hiring date of every employee in the company. Which SQL statement give the required output format
SELECT employee_id, salary, hire_date, of the salary?
ROUND((SYSDATE - hire_date) /365,0) FROM SELECT last_name, TO_INTEGER(salary, $999,999.99)
employees; AS "MONTHLY SALARY" FROM employees WHERE
salary < 10000 WHERE last_name IN 'D%'
You what to generate the average salary of all
employees whose job function is FI_ACCOUNT.
Which of the following SQL command will produce the In creating Joins,the NATURALJOIN and USING clauses
output. are____________
SELECT AVG(salary) FROM employees WHERE job_id = Mutually Exclusive
'FI_ACCOUNT';
Display employee id, lastname, firstname, department Answer: SQL code are embedded within
name, annual salary, location id of employees whose PL/SQL statements
location id is 1700 and working in Finance Department. When an exception is user defined, the
Label the annual salary to ANNUAL SALARY. exception is raised ____________ .
Sort the output in from highest to lowest salary. (4 Answer: Explicitly
POINTS) Which of the folllowing is TRUE?
SELECT E.employee_id, E.last_name, E.first_name, Answer: SQL code are embedded withing
D.department_name, E.salary*12 AS "ANNUAL PL/SQL statements
SALARY", D.location_id Weak REF CURSOR is very flexible.
FROM employees E Answer: True
JOIN jobs J ON E.job_id = J.job_id How do you test the output of a PL/SQL
JOIN departments D ON E.department_id = block?
D.department_id
Answer: Use a predefined Oracle package
WHERE D.location_id = 1700 AND D.department_name
and its procedure
= 'Finance'
Restrictive, specifies a RETURN type,
ORDER BY "ANNUAL SALARY" DESC
associates only with type-compatible
queries are description of a ________________.
Answer: Strong REF CURSOR
Which of the following DOES NOT describes
an exception?
Which of the following does NOT describes Answer: Exception is a PL/SQL error that is
SELECT Statement in a PL/SQL. raised before program execution.
Answer: Queries must return only one These are local variables declared in the
column. parameter list of a subprogram
You want to display all the records of specification.
employee the same with the salary Answer: Formal parameter
employee number 103. Which of the following rules is INCORRECT
Answer: SELECT * FROM employees about cursor variables?
WHERE salary = (SELECT salary from Answer: None of the choices.
employees where employee_id= 103) When an exception is predefined by Oracle
Which of the following stored procedure to server, the exception is raised ____________ .
create a procedure to that will be used to Answer: Explicitly
display the employee id and salary of Which of the following DOES NOT describes
Steven King? an exception?
Answer: CREATE OR REPLACE PROCEDURE Answer: Exception is a PL/SQL error that is
query_emp raised before program execution.
(p_last_name IN employees.last_name Evaluate the following PL/SQL.
%TYPE, CREATE OR REPLACE PROCEDURE
p_first_name IN employees.first_name query_employee
%TYPE, (p_id IN employees.employee_id%TYPE,
p_employee_id OUT employees.employee_id p_name OUT employees.last_name%TYPE,
%TYPE, p_salary OUT employees.salary%TYPE) IS
p_salary OUT employees.salary%TYPE) IS BEGIN SELECT last_name, salary INTO
BEGIN p_name, p_salary
SELECT employee_id, salary INTO FROM employeesWHERE employee_id =
p_employee_id, p_salary p_id;
FROM employees END query_employee
WHERE last_name = p_last_name AND Answer: No error
first_name = p_first_name; You want to know the total number of
END query_emp; employees whose firstname starts with
Which of the folllowing is TRUE? letter D. 
Which of the folllowing PLS/SQL executes CURSOR?
successfully? Answer: Associates with any query
Answer: DECLARE Given the answer in item __________, which
v_first_name employees.first_name of the folllowing stored procedure will
%TYPE := 'D%'; display the employee id and salary of
BEGIN Steven King?
SELECT COUNT(*) INTO v_first_name FROM Answer: DECLARE
employees WHERE first_name LIKE v_employee_id employees.employee_id
v_first_name; %TYPE;
DBMS_OUTPUT.PUT_LINE(v_first_name); v_emp_sal employees.salary%TYPE;
END; BEGIN
What is the error trapping function that query_emp('King', 'Steven', v_employee_id,
returns the numeric value of the error v_emp_sal);
code? DBMS_OUTPUT.PUT_LINE('Employee ID ' ||
Answer: SQLCODE v_employee_id ||' earns '||
You want to display the name, salary and to_char(v_emp_sal, '$999,999.00'));
tax of employee #150. Which of the PL/SQL END;
will execute successfully? Note tax is You have been tasked to update the
computed as 2% of the salary. database by creating a PL/SQL to increase
Answer: DECLARE the salary of all IT Programmer employees
v_first_name VARCHAR2(50); by 50% of their existing salary. 
v_last_name VARCHAR2(50); Which of the following will execute
v_salary INTEGER(20); successfully?
v_tax INTEGER(10); Answer: DECLARE
BEGIN v_job_id employees.job_id%TYPE :=
SELECT first_name, last_name, salary, 'IT_PROG';
salary * 0.02 INTO v_first_name, BEGIN
v_last_name, v_salary, v_tax FROM UPDATE employees SET salary = salary
employees WHERE employee_id = 150; *0.50 WHERE job_id = v_job_id;
DBMS_OUTPUT.PUT_LINE('Firstname : '|| END;
v_first_name); Which of the folllowing is required in a
DBMS_OUTPUT.PUT_LINE('Lastname : '|| subquery?
v_last_name); Answer: SELECT
DBMS_OUTPUT.PUT_LINE('Salary : '|| What is the exception name when PL/SQL
v_salary); has an internal problem
DBMS_OUTPUT.PUT_LINE('Tax : '|| v_tax); Answer: PROGRAM_ERROR
END; In the DECLARE section of the PL/SQL
Which of the following is the syntax to block,
close a cursor? Answer: All of the choices
Answer: CLOSE cursor_variable_name; Actions are being performed when error
Which of the following rules is INCORRECT occurs during PL/SQL execution in the
about cursor variables? Answer: EXCEPTION
Answer: None of the choices. What is the exception name when PL/SQL
What are the three PL/SQL block types? has an internal problem
Answer: Anonymous, Procedure, Function Answer: PROGRAM_ERROR
You can trap any error by including a Which of the folllowing statement
corresponding handler within the describes PL/SQL?
exception-handling section of the PL/SQL Answer: PL/SQL is an Oracle proprietary,
block. procedural, 3GL programming language
Answer: True Evaluate the following PL/SQL.
Which of the following describes weak REF DECLARE
v_employee_id employees.employee_id In PL/SQL Block Structure, which of the
%TYPE := 114; following are mandatory?
BEGIN Answer: BEGIN and END
DELETE employees WHERE employee_id = PL/SQL stands for
v_employee_id; Answer: Procedural Language extension to
END; SQL
Answer: The PL/SQL will delete employee Which of the following is CORRECT about
number 114. sub-queries?
Which of the following command is used to Answer: Subquery execute before the main
create a stand-alone procedure that is query executes.
stored in the Oracle database? Which of the following does NOT describes
Answer: CREATE PROCEDURE SELECT Statement in a PL/SQL.
Evaluate the following PL/SQL. Answer: Queries must return only one
DECLARE column.
v_email VARCHAR(20); PL/SQL Provides a block structure for
BEGIN executable units of ________________.
SELECT email INTO v_email FROM Answer: Code
EMPLOYEES WHERE email like 'D%'; Evaluate the SQL command
DBMS_OUTPUT.PUT_LINE ('Employees SELECT employee_id, salary from
whose email address starts with letter D :' employees where salary = ANY (SELECT
|| v_email); salary FROM employees WHERE job_id =
EXCEPTION 'IT_PROG') AND job_id = 'ST_CLERK'
WHEN TOO_MANY_ROWS THEN Answer: This has no error.
DBMS_OUTPUT.PUT_LINE (' Your select Which of the following PL/SQL will execute
statement retrieved multiple rows.'); successfully?
END; Answer: DECLARE
Answer: The PL/SQL block will run v_salary INTEGER(20);
successfully. BEGIN
Which of the following is the syntax to SELECT salary INTO v_salary FROM
define a REF CURSOR type? employees WHERE employee_id = 150;
Answer: TYPE ref_type_name IS REF END;
CURSOR In PL/SQL Block Structure, which of the
[RETURN return_type]; following are OPTIONAL?
The PL/SQL code block helps modularize Answer: None of the choices
code by using: Evaluate the following PL/SQL. At what line
Answer: All of the choices number is the error of the PL/SQL?
Which of the following is the syntax to DECLARE
fetch from a cursor variable? v_deptno NUMBER := 800;
Answer: FETCH cursor_variable_name INTO e_invalid EXCEPTION;
variable_name1 BEGIN
[,variable_name2,. . .] | record_name; DELETE FROM departments
You want to display all records in the WHERE department_id = v_deptno;
database whose salary is above the salary IF SQL % NOT_FOUND THEN
of Alexander Hunold. RAISE e_invalid;
Answer: SELECT * from employees WHERE END IF;
salary < (SELECT salary FROM employees COMMIT;
WHERE first_name = 'Alexander' AND EXCEPTION
last_name = 'Hunold') WHEN e_invalid THEN
Procedure can be stored in the database as DBMS_OUTPUT.PUT_LINE('No such
a schema object. department id.');
Answer: True END;
Answer: 7 Use column aliases in cursors for calculated columns
What is the error trapping function that fetched into records declared with %COLUMNTYPE.
returns the numeric value of the error Answer: False
code?
Answer: SQLCODE PROG-113A / ► Week 18: Designing PL/SQL / ►
Fetch into a record when fetching from a Learning Activity 14
cursor.
Answer: True Which of the following rules is INCORRECT about
cursor variables?
Answer: None of the choices.
Which of the following is the syntax to open a cursor Which of the following describes weak REF
varial CURSOR?
Answer: OPEN cursor_variable_name Answer: Associates with any query
FOR select_statement; Restrictive, specifies a RETURN type, associates
Which of the following is the syntax to define a REF only with type-compatible queries are description of
CURSOR type? a ________________.
Answer: TYPE ref_type_name IS REF CURSOR Answer: Strong REF CURSOR
[RETURN return_type]; Which of the following is INCORRECT about the
Weak REF CURSOR is very flexible. guidelines for cursor design?
Answer: True Answer: Use column aliases in cursors for
Evaluate the following. What will be the output? calculated columns fetched into records declared
DECLARE with %COLUMNTYPE.
SUBTYPE Accumulator IS NUMBER (4,2); This is a subset of an existing data type that may
v_amount accumulator; place a constraint on its base type.
v_num1 NUMBER; Answer: Subtype
v_num2 NUMBER;
v_num3 NUMBER;
BEGIN
v_amount := 10.50; PROG-113A / ► Week 17: / ► Short Quiz 13
v_num1 := 1; Evaluate the following PL/SQL.
v_num2 := 2;
CREATE OR REPLACE PROCEDURE
v_num3 := 3;
query_employee
v_num1 := v_amount;
(p_id IN employees.employee_id%TYPE,
v_num2 := v_num1 + v_amount;
p_name OUT employees.last_name%TYPE,
v_num2 := v_num2 - v_num3;
p_salary OUT employees.salary%TYPE) IS
dbms_output.put_line('Total is: ' || v_num2);
BEGIN SELECT last_name, salary INTO p_name,
END;
Answer: 18
p_salary
Which of the following is the syntax to fetch from a FROM employeesWHERE employee_id = p_id;
cursor variable? END query_employee
Answer: FETCH cursor_variable_name INTO Answer: No error
variable_name1 Evaluate the following PL/SQL. Which of the
[,variable_name2,. . .] | record_name; following will line creates an error?
Fetch into a record when fetching from a cursor. CREATE OR REPLACE PROCEDURE
Answer: True query_emp
Which of the following is the syntax to close a cursor? (
Answer: CLOSE cursor_variable_name; p_department_id IN employees.department_id
This is a subset of an existing data type that may place a %TYPE,
constraint on its base type. p_name OUT employees.last_name%TYPE,
Answer: Subtype p_salary OUT employees.salary%TYPE
Which of the following rules is INCORRECT about cursor )
variables? IS
Answer: None of the choices. BEGIN
SELECT last_name, salary, department_id INTO Answer: All of the choices
p_name, p_salary, p_department_id Which of the following command is used to create a
FROM employees stand-alone procedure that is stored in the Oracle
WHERE salary >= p_salary AND department_id = database?
p_department_id ; Answer: CREATE PROCEDURE
END query_emp; Which of the folllowing does NOT describes
Answer: Line 3 subprogram?
These are local variables declared in the parameter i. Compiled only once
list of a subprogram specification. ii. Stored in the database
Answer: Formal parameter iii. Do not return values
Given the answer in item __________, which of the
iv. Can take parameters
folllowing stored procedure will display the
v. Unnamed PL/SQL blocks
employee id and salary of Steven King?
Answer: iii & v
Answer: DECLARE
v_employee_id employees.employee_id%TYPE; Which if the following is NOT a benefits of using
v_emp_sal employees.salary%TYPE; modular program constructs?
BEGIN Answer: None of the choices
query_emp('King', 'Steven', v_employee_id, PROG-113A / ► Week 18: Designing PL/SQL / ► Short
v_emp_sal); Quiz 14
DBMS_OUTPUT.PUT_LINE('Employee ID ' ||
Which of the following is the syntax to open a cursor
v_employee_id ||' earns '|| to_char(v_emp_sal,
varial
'$999,999.00'));
Answer: OPEN cursor_variable_name
END;
FOR select_statement;
Which of the following stored procedure to create a Which of the following is the syntax to define a REF
procedure to that will be used to display the CURSOR type?
employee id and salary of Steven King? Answer: TYPE ref_type_name IS REF CURSOR
Answer: CREATE OR REPLACE PROCEDURE [RETURN return_type];
query_emp Weak REF CURSOR is very flexible.
(p_last_name IN employees.last_name%TYPE, Answer: True
p_first_name IN employees.first_name%TYPE, Evaluate the following. What will be the output?
p_employee_id OUT employees.employee_id DECLARE
%TYPE, SUBTYPE Accumulator IS NUMBER (4,2);
p_salary OUT employees.salary%TYPE) IS v_amount accumulator;
BEGIN v_num1 NUMBER;
SELECT employee_id, salary INTO v_num2 NUMBER;
p_employee_id, p_salary v_num3 NUMBER;
FROM employees BEGIN
WHERE last_name = p_last_name AND first_name v_amount := 10.50;
= p_first_name; v_num1 := 1;
END query_emp;
v_num2 := 2;
What is the default parameter mode when no mode
v_num3 := 3;
is specified?
v_num1 := v_amount;
Answer: IN
v_num2 := v_num1 + v_amount;
PROG-113A / ► Week 16: Creating Procedures / ► v_num2 := v_num2 - v_num3;
Learning Activity 13 dbms_output.put_line('Total is: ' || v_num2);
Procedure can be stored in the database as a schema END;
object. Answer: 18
Answer: True Which of the following is the syntax to fetch from a
The PL/SQL code block helps modularize code by using: cursor variable?
Answer: FETCH cursor_variable_name INTO
variable_name1 In PL/SQL Block Structure, which of the following
[,variable_name2,. . .] | record_name; are mandatory?
Fetch into a record when fetching from a cursor. Answer: BEGIN and END
Answer: True This is a type of cursor which is created and
Which of the following is the syntax to close a cursor? managed internally by the Oracle server to process
Answer: CLOSE cursor_variable_name; SQL statements
This is a subset of an existing data type that may place a Answer: Implicit
constraint on its base type. PL/SQL stands for
Answer: Subtype Answer: Procedural Language extension to SQL
Which of the following rules is INCORRECT about cursor
Which of the following PL/SQL will execute
successfully?
variables?
Answer: DECLARE
Answer: None of the choices.
v_salary INTEGER(20);
Use column aliases in cursors for calculated columns
BEGIN
fetched into records declared with %COLUMNTYPE. SELECT salary INTO v_salary FROM employees
Answer: False WHERE employee_id = 150;
END;
PROG-113A / ► Week 18: Designing PL/SQL / ► What is the last clause in trapping exceptions?
Learning Activity 14 Answer: WHEN OTHERS
PL/SQL Provides a block structure for executable
Which of the following rules is INCORRECT about units of ________________.
cursor variables? Answer: Code
Answer: None of the choices. Evaluate the following PL/SQL.
Which of the following describes weak REF DECLARE
CURSOR? v_email VARCHAR(20);
Answer: Associates with any query BEGIN
Restrictive, specifies a RETURN type, associates SELECT email INTO v_email FROM
only with type-compatible queries are description of EMPLOYEES WHERE email like 'D%';
a ________________. DBMS_OUTPUT.PUT_LINE ('Employees whose
Answer: Strong REF CURSOR email address starts with letter D :'
Which of the following is INCORRECT about the || v_email);
guidelines for cursor design? EXCEPTION
Answer: Use column aliases in cursors for WHEN TOO_MANY_ROWS THEN
calculated columns fetched into records declared DBMS_OUTPUT.PUT_LINE (' Your select
with %COLUMNTYPE. statement retrieved multiple rows.');
This is a subset of an existing data type that may END;
place a constraint on its base type. Answer: The PL/SQL block will run successfully.
Answer: Subtype Which of the folllowing is TRUE?
Answer: SQL code are embedded within PL/SQL
PROG-113A / ► Week 15: Long Quiz / ► Long statements
Quiz 3 (30/30) You can trap any error by including a corresponding
(Correction) handler within the exception-handling section of the
How do you test the output of a PL/SQL block? PL/SQL block.
Answer: Use a predefined Oracle package and its Answer: True
procedure When an exception is user defined, the exception is
Which of the folllowing statement describes raised ____________ .
PL/SQL? Answer: Explicitly
Answer: PL/SQL is an Oracle proprietary, Evaluate the PL/SQL
procedural, 3GL programming language DECLARE
Which of the following syntax to declare v_first_name VARCHAR2(50);
EXCEPTION named e_invalid_id? v_last_name VARCHAR2(50);
Answer: e_invalid_id EXCEPTION; v_salary INTEGER(20);
BEGIN v_employee_id employees.employee_id%TYPE :=
SELECT first_name, last_name, salary INTO 114;
v_first_name, v_last_name, v_salary FROM BEGIN
employees WHERE department_id = 60; DELETE employees WHERE employee_id =
DBMS_OUTPUT.PUT_LINE('Firstname : '|| v_employee_id;
v_first_name); END;
DBMS_OUTPUT.PUT_LINE('Lastname : '|| Answer: The PL/SQL will delete employee number
v_last_name); 114.
DBMS_OUTPUT.PUT_LINE('Salary : '|| v_salary); In the DECLARE section of the PL/SQL block,
END; Answer: All of the choices
Answer: Error in Line 6. When an exception is predefined by Oracle server,
Evaluate the following PL/SQL. the exception is raised ____________ .
DECLARE Answer: Explicitly
v_employee_id employees.employee_id%TYPE := Which of the will display the Employee ID and
114; number of years in service with employee ID 150?
BEGIN Answer: DECLARE
DELETE employees WHERE employee_id = v_salaryemployees.salary%TYPE := 10000;
v_employee_id; v_employee_idemployees.employee_id%TYPE :=
END; 150;
Answer: The PL/SQL will delete employee number v_years INTEGER(10);
114. BEGIN
Which of the following does NOT describes SELECT employee_id, ROUND((SYSDATE -
SELECT Statement in a PL/SQL. hire_date) /365,0) INTO v_employee_id, v_years
Answer: Queries must return only one column. FROM employees WHERE employee_id =
What are the three PL/SQL block types? v_employee_id ;
Answer: Anonymous, Procedure, Function DBMS_OUTPUT.PUT_LINE('Employee ID:' ||
What is the exception name when PL/SQL has an v_employee_id);
internal problem DBMS_OUTPUT.PUT_LINE('Number of years : '
Answer: PROGRAM_ERROR || v_years);
You have been tasked to update the database by END;
creating a PL/SQL to increase the salary of all IT Actions are being performed when error occurs
Programmer employees by 100% of their existing during PL/SQL execution in the
salary. Which of the following will execute Answer: EXCEPTION
successfully? You can use this procedure to issue user-defined
Answer: DECLARE error messages from stored subprograms.
v_job_id employees.job_id%TYPE := 'IT_PROG'; Answer: RAISE_APPLICATION_ERROR
BEGIN
UPDATE employees SET salary = salary * 2
WHERE job_id = v_job_id;
END; PROG-113A / ► Week 14: Handling Exceptions /
What is the error trapping function that returns the ► Short Quiz 12
numeric value of the error code?
Answer: SQLCODE Evaluate the following PL/SQL.
What is the exception name when single row DECLARE
SELECT returned no data. v_email VARCHAR(20);
Answer: NO_DATA_FOUND BEGIN
Which of the following DOES NOT describes an SELECT email INTO v_email FROM
exception? EMPLOYEES WHERE email like 'D%';
Answer: Exception is a PL/SQL error that is raised DBMS_OUTPUT.PUT_LINE ('Employees whose
before program execution. email address starts with letter D :'
Evaluate the following PL/SQL. || v_email);
DECLARE EXCEPTION
WHEN TOO_MANY_ROWS THEN EXCEPTION named e_invalid_id?
DBMS_OUTPUT.PUT_LINE (' Your select Answer: e_invalid_id EXCEPTION;
statement retrieved multiple rows.'); When an exception is predefined by Oracle server,
END; the exception is raised ____________ .
Answer: The PL/SQL block will run successfully. Answer: Explicitly
Which of the following DOES NOT describes an When an exception is user defined, the exception is
exception? raised ____________ .
Answer: Exception is a PL/SQL error that is raised Answer: Explicitly
before program execution. You can trap any error by including a corresponding
What is the exception name when single row handler within the exception-handling section of the
SELECT returned no data. PL/SQL block.
Answer: NO_DATA_FOUND Answer: True
RAISE_APPLICATION_ERROR is used in two
different places. These are ___________________. PROG-113A / ► Week 13: Interacting with Oracle
Answer: Executable and exceptions section Server / ► Learning Activity 11
What is the error trapping function that returns the
numeric value of the error code? Which of the following does NOT describes
Answer: SQLCODE SELECT Statement in a PL/SQL.
What is the exception name when PL/SQL has an Answer: Queries must return only one column.
internal problem Evaluate the following PL/SQL.
Answer: PROGRAM_ERROR 1 DECLARE
Evaluate the following PL/SQL. At what line
number is the error of the PL/SQL? 2 v_employee_id employees.employee_id
DECLARE %TYPE := 114;
v_deptno NUMBER := 800;
e_invalid EXCEPTION; 3 BEGIN
BEGIN
DELETE FROM departments 4 DELETE employees WHERE employee_id =
WHERE department_id = v_deptno; v_employee_id;
IF SQL % NOT_FOUND THEN
RAISE e_invalid; 5 END;
END IF; Answer: The PL/SQL will delete employee number
COMMIT; 114.
EXCEPTION Which of the following PL/SQL that will display
WHEN e_invalid THEN the total number employees whose salary is 10000
DBMS_OUTPUT.PUT_LINE('No such department and above?
id.'); Answer: DECLARE
END; v_salary employees.salary%TYPE := 10000;
Answer: 7 BEGIN
What is the last clause in trapping exceptions? SELECT COUNT(*) INTO v_salary FROM
Answer: WHEN OTHERS employees WHERE salary >= v_salary;
Complete the diagram in Trapping Non-Predefined DBMS_OUTPUT.PUT_LINE(v_salary);
Oracle Server Errors. END;
Answer: Declare, Associate, Reference This is a type of cursor which is created and
managed internally by the Oracle server to process
PROG-113A / ► Week 14: Handling Exceptions / SQL statements
► Learning Activity 12 Answer: Implicit
You have been tasked to update the database by
You can use this procedure to issue user-defined creating a PL/SQL to increase the salary of all IT
error messages from stored subprograms. Programmer employees by twice of their existing
Answer: RAISE_APPLICATION_ERROR salary. Which of the following will execute
Which of the following syntax to declare successfully?
Answer: DECLARE Answer: Procedural Language extension to SQL
v_job_id employees.job_id%TYPE := 'IT_PROG'; PL/SQL Provides a block structure for executable units
BEGIN of ________________.
UPDATE employees SET salary = salary * 2 Answer: Code
WHERE job_id = v_job_id; In PL/SQL Block Structure, which of the following are
END; mandatory?
Answer: BEGIN and END
PROG-113A / ► Week 12: Introduction to Which of the following PL/SQL will execute successfully?
PLSQL / ► Short Quiz 10 Answer: DECLARE
v_salary INTEGER(20);
Which of the folllowing is TRUE? BEGIN
Answer: SQL code are embedded withing PL/SQL
SELECT salary INTO v_salary FROM employees WHERE
statements
employee_id = 150;
In the DECLARE section of the PL/SQL block
END;
Answer: All of the choices
In PL/SQL Block Structure, which of the following Actions are being performed when error occurs during
are OPTIONAL? PL/SQL execution in the
Answer: None of the choices Answer: EXCEPTION
What are the three PL/SQL block types?
Answer: Anonymous, Procedure, Function
How do you test the output of a PL/SQL block?
PROG-113A / ► Week 11: Using Subqueries to
Answer: Use a predefined Oracle package and its
Solve Queries / ► Short Quiz 9
procedure
You want to display the name, salary and tax of
You want to display the department name the same
employee #150. Which of the PL/SQL will execute
with the location of the Purchasing department.
successfully? Note tax is computed as 2% of the
Answer: SELECT department_name from
salary.
departments where location_id = (SELECT
Answer: DECLARE
location_id from departments where
v_first_name VARCHAR2(50);
department_name = 'Purchasing')
v_last_name VARCHAR2(50);
v_salary INTEGER(20);
Evaluate the SQL command
v_tax INTEGER(10);
SELECT employee_id, job_id, salary from
BEGIN
employees where salary < ALL (SELECT salary
SELECT first_name, last_name, salary, salary *
FROM employees WHERE job_id =
0.02 INTO v_first_name, v_last_name, v_salary,
'FI_ACCOUNT') AND job_id = 'IT_PROG'
v_tax FROM employees WHERE employee_id =
Answer: This has no error.
150;
DBMS_OUTPUT.PUT_LINE('Firstname : '||
You want to display all records in the database
v_first_name);
whose salary is above the salary of Alexander
DBMS_OUTPUT.PUT_LINE('Lastname : '||
Hunold.
v_last_name);
Answer: SELECT * from employees WHERE
DBMS_OUTPUT.PUT_LINE('Salary : '|| v_salary);
salary < (SELECT salary FROM employees
DBMS_OUTPUT.PUT_LINE('Tax : '|| v_tax);
WHERE first_name = 'Alexander' AND last_name
END;
= 'Hunold')
Which of the folllowing statement describes
PL/SQL?
Evaluate the SQL command
Answer: PL/SQL is an Oracle proprietary,
SELECT employee_id, last_name, first_name,
procedural, 3GL programming language
job_id FROM employees WHERE department_id =
(SELECT max(department_id) FROM employees
PROG-113A / ► Week 12: Introduction to PLSQL / ►
GROUP BY department_id)
Learning Activity 10
PL/SQL stands for
Answer: This will return an error. Single-row Select one:
subquery returns more than one row. a. SELECT job_title FROM jobs WHERE min_salary
>= 5000 AND max_salary<= 10000
You want to display all employee id, name, hired
date and salary who are hired after employee 104 b. SELECT job_title FROM employees WHERE
salary >= 5000 AND salary <= 10000
was hired.
Answer: SELECT employee_id, last_name, c. SELECT employees_id, job_title FROM employees
hire_date, salary FROM employees WHERE WHERE salary >= 5000 AND salary <= 10000
TO_NUMBER(TO_CHAR(hire_date, 'YYYY')) > d. SELECT job_title FROM jobs WHERE salary >=
(SELECT TO_NUMBER(TO_CHAR(hire_date, 5000 AND salary <= 10000
'YYYY')) FROM employees WHERE employee_id
= 104) Question 2
Complete
Mark 2.00 out of 2.00

PROG-113A / ► Week 11: Using Subqueries to Solve


Queries / ► Learning Activity 9
Flag question
Which of the following is INCORRECT?
Answer: Use single-row operators with multiple-row Question text
subqueries What is the SQL command to count the number of
Which of the folllowing is required in a subquery? records in the employees table?
Answer: SELECT Select one:
Which of the following is CORRECT about sub-queries?
Answer: Subquery execute before the main query a. SELECT ALL FROM employees
executes. b. SELECT * FROM employees;
Evaluate the SQL Command
c. SELECT COUNT(*) FROM employees
SELECT job_id, job_title FROM jobs J WHERE INCLUDES
(SELECT * FROM employees WHERE J.job_id = d. SELECT SUM(*) FROM employees;
e.job_id );
Question 3
Answer: The SQL will return an error. Invalid Complete
"INCLUDES" parameter. Mark 2.00 out of 2.00
Evaluate the SQL command
SELECT employee_id, salary from employees where
salary = ANY (SELECT salary FROM employees WHERE
job_id = 'IT_PROG') AND job_id = 'ST_CLERK'
Answer: This has no error. Flag question

Question 1 Question text


Complete
Mark 2.00 out of 2.00
True or False. The AND, OR, NOT are comparison
operators.
Select one:
True
False
Flag question

Question text Question 4


Complete
You want to display all the job position titles whose Mark 2.00 out of 2.00
salary is salary from 5,000 to 12,000 arrange from
highest to lowest
Flag question Flag question

Question text Question text


Evaluate the following SQL command You want to generate the total salary per month of
SELECT * FROM jobs WHERE job_title LIKE every department in the company.
'Manager%'
Select one:
Select one:
a. SELECT department_id, salary FROM employees
a. The SQL command will produce an error. ORDER BY SUM(salary)
b. The SQL command will display all employees with b. SELECT department_id, TOTAL(salary) FROM
Manager position employees GROUP BY department_id
c. The SQL command will display all records in the c. SELECT department_id, salary FROM employees
database GROUP BY SUM(salary) ORDER BY department_id
d. No records will be displayed d. SELECT department_id, SUM(salary) FROM
employees GROUP BY department_id
Question 5
Complete Question 7
Mark 2.00 out of 2.00 Complete
Mark 2.00 out of 2.00

Flag question
Flag question
Question text
Question text
You want to display all the employee id and the month
an employee was hired. You want to display the employee's last name whose
Which SQL statement give the required output? salary is below 10,000 and whose lastname starts
with letter D. 
Select one: Which SQL statement give the required output format
a. SELECT employee_id, hire_date, of the salary?
TO_DATE(hire_date,'Month') AS "Hired Month", Select one:
job_id FROM
a. SELECT last_name, TO_INT(salary, '$999,999.99')
b. SELECT employee_id, hire_date, AS "MONTHLY SALARY" FROM employees WHERE
MONTH(hire_date,'Month') AS "Hired Month", job_id salary < 10,000 WHERE last_name STARTS 'D%'
FROM employees
b. SELECT last_name, TO_CHAR(salary,
c. SELECT employee_id, hire_date, '$999,999.99') AS "MONTHLY SALARY" FROM
TO_CHAR(hire_date,'Month') AS "Hired Month", employees WHERE salary < 10000 WHERE
job_id FROM employees last_name LIKE 'D%'
d. SELECT employee_id, hire_date, c. SELECT last_name, TO_INTEGER(salary,
TO_MONTH(hire_date,'Month') AS "Hired Month", $999,999.99) AS "MONTHLY SALARY" FROM
job_id FROM employees employees WHERE salary < 10000 WHERE
last_name IN 'D%'
Question 6
Complete d. SELECT last_name, TO_NUMBER(salary,
Mark 2.00 out of 2.00
'$999,999.99') AS "MONTHLY SALARY" FROM
employees WHERE salary < 10,000 WHERE
last_name = ‘D%’
Question 8 Question 10
Complete Complete
Mark 2.00 out of 2.00 Mark 2.00 out of 2.00

Flag question Flag question

Question text Question text


Display the lastname of every employee in the Austin David was transferred to Purchasing
company. Display the output in a single column and Department. You are assigned to update the
label it as Fullname database. 
Format: JuanReyes Which of the following SQL command will satisfy the
requirements?
Select one:
Select one:
a. None of the choices
a. UPDATE first_name = ‘David’ AND last_name =
b. SELECT CONCATENATE(first_name, last_name) ‘Austin’ FROM employees SET department_id = 30
AS Fullname FROM employees
b. UPDATE department_id = 30 WHERE first_name
c. SELECT CONCAT(first_name, last_name) FROM = ‘David’ AND last_name = ‘Austin’
employees
c. UPDATE employees WHERE department_id = 30
d. SELECT CONCAT(first_name, last_name) AS SET first_name = ‘David’ AND last_name = ‘Austin’
Fullname FROM employees
d. UPDATE employees SET department_id = 30
Question 9 WHERE first_name = ‘David’ AND last_name =
Complete ‘Austin’
Mark 0.00 out of 2.00
Question 11
Complete
Mark 2.00 out of 2.00

Flag question

Question text
Display the first 5 letter in the surname of all the Flag question
employees whose firstname starts with letter 'N' Question text
Select one: John want to know how many employees receiving
a. SELECT SUBSTR(last_name,1,5), first_name salary below 10,000.
FROM employees WHERE first_name IN 'N' What SQL command he need to run?

b. SELECT SUBSTR(last_name,1,5), first_name Select one:


FROM employees WHERE SUBSTR(first_name,1,1) a. SELECT COUNT(*) FROM employees WHERE
= 'N' salary < 10000;
c. SELECT SUBSTR(surname,1,5), first_name b. SELECT COUNT(salary) FROM employees
FROM employees WHERE SUBSTR(first_name,1,1) WHERE salary < 10,000;
IN 'N'
c. SELECT COUNT(emp_id) FROM employees
d. SELECT SUBSTR(surname,1,5), first_name WHERE salary <= 10000;
FROM employees WHERE first_name = 'N'
d. SELECT salary FROM
e. SELECT SUBSTR(last_name,1,5), first_name COUNT(employees)WHERE salary < 10000;
FROM employees WHERE SUBSTR(first_name,1,1)
IN 'N' Question 12
Complete
Mark 2.00 out of 2.00 d. SELECT last_name, hire_date FROM employees
WHERE hire_date>= 
TO_DATE('2000', 'YYYY') AND hire_date<=
TO_DATE('2006', 'YYYY') OR salary > 5000;

Question 14
Flag question Complete
Mark 2.00 out of 2.00
Question text
Evaluate the following SQL command
SELECT employee_id, salary, department_id FROM
employees WHERE department_id IN (60,70)
Select one: Flag question

a. The SQL command will produce an error. Question text

b. The SQL command will display employees with List all employees except for IT_PROG job id.
department id 60 and 70. Select one:
c. The SQL command will give an incorrect output. a. SELECT *FROM employees EXCEPT JOB_ID !=
d. The SQL command will display employees with 'IT_PROG'
department id 60 or 70. b. SELECT *FROM employees WHERE JOB_ID
NOT IN ('IT_PROG')
Question 13
Complete c. SELECT *FROM employees WHERE JOB_ID <>
Mark 2.00 out of 2.00 'IT_PROG'
d. All of the choices

Question 15
Complete
Mark 2.00 out of 2.00
Flag question

Question text
You want to display the employee's last name and
date hired in year 2000 to2006 whose salary is above
5000. Which SQL statement give the required output? Flag question
Select one: Question text
a. SELECT last_name, hire_date FROM employees Evaluate the following SQL command
WHERE hire_date>=  SELECT employee_id, min_salary, max_salary
TO_DATE('01-Jan-2006', 'DD-Mon-RR') AND FROM employees, departments WHERE
hire_date<= TO_DATE('31-Dec-2006', 'DD-Mon-RR') salary>= 10000 && salary <= 20000
AND salary > 5000;
Select one:
b. SELECT last_name, hire_date FROM employees
WHERE hire_date>=  a. The SQL will produce Cartesian Product
TO_DATE('Jan-2000', 'Month-YYYY') AND
hire_date<= TO_DATE('Dec-2006', 'Month-‘YYYY') b. The SQL will display the employee id, department
AND salary > 5,000; id and the minimum and maximum salary whose
salary is between 10000 and 20000.
c. SELECT last_name, hire_date FROM employees
WHERE hire_date>=  c. The SQL command will produce an error.
TO_DATE('01-Jan-2000', 'DD-Mon-YYYYY') AND d. The SQL command will give an incorrect output.
hire_date<= TO_DATE('31-Dec-2006', 'DD-Mon-
YYYY') AND salary ABOVE 5000; Question 16
Complete
Mark 2.00 out of 2.00
Flag question Flag question

Question text Question text


Display all the records in the employee table. Arrange You what to generate the average salary of all
the output in by lastname from A-Z order. employees whose job function is FI_ACCOUNT. 
Which of the following SQL command will produce the
Select one: output.
a. SELECT * FROM employees SORT BY lastname Select one:
b. SELECT * FROM employees ORDER BY lastname a. SELECT AVERAGE(salary) FROM employees
c. SELECT * FROM employees ORDER BY lastname WHERE job_id = 'FI_ACCOUNT';
AZ b. SELECT AVG(salary) FROM employees WHERE
d. SELECT * FROM employees SORT BY lastname job_id = 'FI_ACCOUNT';
ascending c. SELECT AVE(salary) FROM employees WHERE
job_id = 'FI_ACCOUNT';
Question 17
Complete d. SELECT COUNT AVG(salary) FROM employees
Mark 2.00 out of 2.00
WHERE job_id = 'FI_ACCOUNT';

Question 19
Complete
Mark 2.00 out of 2.00

Flag question

Question text
Display employee's name and id whose firstname
starts with letter D and job id is IT_PROG.  Flag question
Sort the output by department. Question text
Select one: Display all location id between 1000 to 2000.
a. SELECT employee_id, first_name, last_name Select one:
FROM employees ORDER BY department_id
WHERE first_name LIKE 'D%' and job_id = a. DISPLAY location_id FROM departments WHERE
'IT_PROG' location_id LING 1000 UP TO 2000
b. SELECT employees FROM employee_id, b. DISPLAY location_id FROM departments WHERE
first_name, last_name WHERE first_name LIKE ‘D%’ location_id BETWEEN 1000 TO 2000
and job_id = ‘IT_PROG’ ORDER BY department_id
c. SELECT location_id FROM departments WHERE
c. SELECT employee_id, first_name, last_name location_id IN 1000 AND 2000
FROM employees WHERE job_id = 'IT_PROG' OR
first_name LIKE 'D%' and ORDER BY department_id d. SELECT location_id FROM departments WHERE
location_id BETWEEN 1000 AND 2000
d. SELECT employee_id, first_name, last_name
FROM employees WHERE first_name LIKE 'D%' and Question 20
job_id = 'IT_PROG' ORDER BY department_id Complete
Mark 2.00 out of 2.00
Question 18
Complete
Mark 2.00 out of 2.00
Flag question Flag question

Question text Question text


What will be the SQL command if every employee will Display the employee's name, job title, job_id and the
be given a productivity bonus which is equivalent to department name of employees with department id of
3% of the monthly salary? 100.
Display the employee id, salary and the productivity
bonus. Select one:

Select one: a. SELECT E.employee_id, J.job_title, e.job_id,


D.department_name
a. SELECT employee_id, salary, salary + (salary .03) FROM employees E 
FROM employees JOIN jobs J ON E.job_id = J.job_id
JOIN departments D ON E.department_id =
b. SELECT employee_id, salary, salary * .03 FROM D.department_id
employees WHERE E.department_id = 100
c. SELECT employee_id, salary, salary * 1.03 FROM b. SELECT E.employee_id, J.job_title, e.job_id,
employees D.department_name
d. SELECT employee_id, salary FROM employees FROM employees E 
WHERE salary) JOIN department D ON E.job_id = J.job_id
JOIN jobs J ON E.department_id = D.department_id
e. SELECT employee_id, salary, salary * .30 FROM WHERE E.department_id = 100
employees
c. SELECT E.employee_id, J.job_title, e.job_id,
Question 21 D.department_name
Complete FROM jobs J
Mark 2.00 out of 2.00 INNER JOIN department D ON E.job_id = J.job_id
INNER JOIN employees EON E.department_id =
D.department_id
WHERE E.department_id = 100
d. SELECT E.employee_id, J.job_title, e.job_id,
Flag question D.department_name
FROM jobs J
Question text NATURAL JOIN department D ON E.job_id = J.job_id
NATURAL JOIN employees E ON E.department_id =
Display the employee id, salary, number of years and D.department_id
the hiring date of every employee in the company. WHERE E.department_id = 100
Select one:
Question 23
a. SELECT employee_id,salary, hire_date, hire_date- Complete
Mark 2.00 out of 2.00
SYSDATE /365 FROM employees;
b. SELECT employee_id, salary, hire_date,
ROUND((SYSDATE - hire_date) /365,0) FROM
employees;
c. SELECT employee_id, salary, hire_date, Flag question
hire_date /365 FROM employees;
Question text
Question 22
Complete In creating Joins,the NATURALJOIN and USING
Mark 2.00 out of 2.00 clauses are____________
Select one:
a. Mutually Inclusive d. SELECT E.employee_id, E.last_name,
E.first_name, D.department_name, E.salary*12 AS
b. Limited to 2 relational tables "ANNUAL SALARY", D.location_id
c. Opposite FROM employees E 
OUTER JOIN jobs J ON E.job_id = J.job_id
d. Mutually Exclusive OUTER JOIN departments D ON E.department_id =
D.department_id
Question 24 WHERE D.location_id = 1700 AND
Complete D.department_name = 'Finance' 
Mark 4.00 out of 4.00
ORDER BY "ANNUAL SALARY" DESC

Flag question

Question text PROG-113A-LAB-1812S / (47/50)► Week


Display employee id, lastname, firstname, department 10: Quarterly Examination / ► First Quarter
name, annual salary, location id of employees whose Exam
location id is 1700 and working in Finance
Department. Label the annual salary to ANNUAL Question 1
SALARY.  Answer saved
Sort the output in from highest to lowest salary. (4 Marked out of 1.00
POINTS) Remove flag

Select one: Question text

a. SELECT E.employee_id, E.last_name, You can relate data to multiple tables using a foreign
E.first_name, D.department_name, E.salary*12 AS key.
"ANNUAL SALARY", D.location_id Select one:
FROM employees E  True
NATURAL JOIN jobs J ON E.job_id = J.job_id False
NATURAL JOIN departments D ON E.department_id
= D.department_id Question 2
ORDER BY "ANNUAL SALARY" DESC Answer saved
WHERE D.location_id = 1700 AND Marked out of 1.00
D.department_name = 'Finance' Remove flag

b. SELECT E.employee_id, E.last_name, Question text


E.first_name, D.department_name, E.salary*12 AS Which of the following SELECT statement is the
"ANNUAL SALARY", D.location_id correct report that will deduct 5 from ONHAND,
FROM employees E  multiply 5 in WAREHOUSE, after getting the value on
JOIN jobs J ON E.job_id = J.job_id both ONHAND and WAREHOUSE add their data: as
JOINemployees E ON E.department_id = shown below: ONHAND - 5 + 5 * WAREHOUSE
D.department_id Note that you have to force the Oracle to prioritize first
WHERE D.location_id = 1700 AND the Subtraction over Multiplication. List only the
D.department_name = 'Finance'  column DESCRIPTION, ONHAND and
ORDER BY "ANNUAL SALARY" DESC WAREHOUSE.
c. SELECT E.employee_id, E.last_name, Select one:
E.first_name, D.department_name, E.salary*12 AS a. SELECT (ONHAND-5) + 5(* WAREHOUSE),
"ANNUAL SALARY", D.location_id DESCRIPTION FROM PARTS;
FROM employees E  b. SELECT ONHAND-5 + 5 * WAREHOUSE,
JOIN jobs J ON E.job_id = J.job_id DESCRIPTION FROM PARTS;
JOIN departments D ON E.department_id = c. SELECT (ONHAND-5) + 5 * WAREHOUSE,
D.department_id DESCRIPTION FROM PARTS;
WHERE D.location_id = 1700 AND d. SELECT ONHAND-5 + 5 (* WAREHOUSE),
D.department_name = 'Finance'  DESCRIPTION FROM PARTS;
ORDER BY "ANNUAL SALARY" DESC
Question 3 c. SELECT last_name, TO_INTEGER(salary,
Answer saved $999,999.99) AS "MONTHLY SALARY" FROM
Marked out of 1.00 employees WHERE salary < 10000 WHERE
Flag question last_name IN 'K%'
Question text d. SELECT last_name, TO_INT(salary, '$999,999.99')
AS "MONTHLY SALARY" FROM employees WHERE
INSERT, DELETE, UPDATE are ________________ salary < 10,000 WHERE last_name STARTS 'K%'
commands
Question 6
Select one: Answer saved
a. DCL Marked out of 1.00
b. DML Remove flag
c. DDL Question text
d. All of the choices
Which of the following is the correct report that will
Question 4 display the CLASS from table PARTS.
Answer saved
Marked out of 1.00 Select one:
Flag question a. SELECT * CLASS FROM PARTS;
Question text b. SELECT CLASS AS CLASS FROM PARTS;
c. SELECT 'CLASS' FROM PARTS;
What will be the SQL command if every employee will d. SELECT CLASS FROM PARTS;
be given a productivity bonus which is equivalent to
3% of the monthly salary? Question 7
Display the employee id, salary and the productivity Answer saved
Marked out of 1.00
bonus. Remove flag
Select one: Question text
a. SELECT employee_id, salary, salary * .03 FROM
employees Evaluate the following SQL command
b. SELECT employee_id, salary, salary * .30 FROM SELECT employee_id, salary, department_id FROM
employees employees WHERE department_id IN (60,70)
c. SELECT employee_id, salary, salary * 1.03 FROM
employees Select one:
d. SELECT employee_id, salary, salary + (salary .03) a. The SQL command will display employees with
FROM employees department id 60 or 70.
e. SELECT employee_id, salary FROM employees b. The SQL command will give an incorrect output.
WHERE salary) c. The SQL command will produce an error.
d. The SQL command will display employees with
Question 5 department id 60 and 70.
Answer saved
Marked out of 1.00 Question 8
Flag question Answer saved
Marked out of 1.00
Question text Remove flag

You want to display the employee’s last name Question text


whose salary is below 10,000 and whose lastname You what to generate the average salary of all
starts with letter K.  employees whose job function is FI_ACCOUNT. 
Which SQL statement give the required output Which of the following SQL command will produce the
format of the salary?  output.

Select one: Select one:


a. SELECT last_name, TO_CHAR(salary, a. SELECT AVG(salary) FROM employees WHERE
'$999,999.99') AS "MONTHLY SALARY" FROM job_id = 'FI_ACCOUNT';
employees WHERE salary < 10000WHERE b. SELECT AVE(salary) FROM employees WHERE
last_name LIKE ‘K%’ job_id = 'FI_ACCOUNT';
b. SELECT last_name, TO_NUMBER(salary, c. SELECT AVERAGE(salary) FROM employees
'$999,999.99') AS "MONTHLY SALARY" FROM WHERE job_id = 'FI_ACCOUNT';
employees WHERE salary < 10,000WHERE d. SELECT COUNT AVG(salary) FROM employees
last_name = ‘K%’ WHERE job_id = 'FI_ACCOUNT';
Question 9 d. CREATE gen_manager ROLE
Answer saved
Marked out of 1.00 Question 12
Remove flag Answer saved
Marked out of 1.00
Question text Flag question

Evaluate the following SQL command Question text


SELECT employee_id, min_salary, max_salary
FROM employees, departments WHERE What is the SQL command to display the date of the
salary>= 10000 && salary <= 20000 first employee that was hired?

Select one: Select one:


a. The SQL will produce Cartesian Product a. SELECT FIRST(hire_date) FROM employees;
b. The SQL will display the employee id, department b. SELECT hire_date FROM employees WHERE
id and the minimum and maximum salary whose TO_CHAR(hire_date) = ‘FIRST’;
salary is between 10000 and 20000. c. SELECT MIN(hire_date) FROM employees;
c. The SQL command will give an incorrect output. d. SELECT hire_date FROM employees WHERE
d. The SQL command will produce an error. FIRST(hire_date );

Question 10 Question 13
Answer saved Answer saved
Marked out of 1.00 Marked out of 1.00
Flag question Flag question

Question text Question text

You want to display the employee's last name whose You want to display the employee id and the year
salary is below 10,000 and whose lastname starts when an employee was hired. 
with letter D.  Which SQL statement give the required output?
Which SQL statement give the required output format Select one:
of the salary? a. SELECT employee_id, YEAR(hire_date,'YYYY')
Select one: FROM employees;
a. SELECT last_name, TO_INTEGER(salary, b. SELECT employee_id, YEAR(hire_date') FROM
$999,999.99) AS "MONTHLY SALARY" FROM employees;
employees WHERE salary < 10000 WHERE c. SELECT employee_id,
last_name IN 'D%' TO_YEAR(hire_date,'YYYY') FROM employees;
b. SELECT last_name, TO_INT(salary, '$999,999.99') d. SELECT employee_id,
AS "MONTHLY SALARY" FROM employees WHERE TO_CHAR(hire_date,'YYYY') FROM employees;
salary < 10,000 WHERE last_name STARTS 'D%'
Question 14
c. SELECT last_name, TO_CHAR(salary, Answer saved
'$999,999.99') AS "MONTHLY SALARY" FROM Marked out of 1.00
employees WHERE salary < 10000 WHERE Remove flag
last_name LIKE 'D%'
d. SELECT last_name, TO_NUMBER(salary, Question text
'$999,999.99') AS "MONTHLY SALARY" FROM Evaluate the following SQL command
employees WHERE salary < 10,000 WHERE SELECT employee_id, hire_date, department_name
last_name = ‘D%’ FROM employees, departments
WHERE departments.department_id =
Question 11
employees.department_id
Answer saved
Marked out of 1.00
Flag question
Select one:
a. The SQL command will produce an error.
Question text b. The SQL command will give an incorrect output.
c. The SQL command should have ALIAS for the
Which of the following will is the correct command to table to produce a correct output.
create a role. d. The SQL command will produce a correct output.
Select one:
Question 15
a. CREATE ROLE gen_manager Answer saved
b. None of the choices Marked out of 1.00
c. GRANT ROLE gen_manager Remove flag
Question text b. SELECT AVE(salary) FROM employees WHERE
job_id = 'IT_PROG';
Display all the records whose stock is below 20 and in c. SELECT AVG(salary) FROM employees WHERE
warehouse number 3. job_id = 'IT_PROG';
Select one: d. SELECT COUNT AVG(salary) FROM employees
a. SELECT * FROM parts WHERE onhand< 20 OR WHERE job_id = 'IT_PROG';
warehouse = 3;
Question 19
b. SELECT * FROM parts WHERE onhand> 20 OR
Answer saved
warehouse = 3; Marked out of 1.00
c. SELECT * FROM parts WHERE onhand< 20 AND Flag question
warehouse = 3;
d. SELECT * FROM parts WHERE onhand<= 20 AND Question text
warehouse = 3; A _______________ consists of a collection of DML
e. SELECT ALL FROM parts WHERE onhand< 20 statements that form a logical unit of work.
AND warehouse = 3;
f. SELECT ALL FROM parts WHERE onhand<= 20 Select one:
AND warehouse = 3; a. All of the choices
b. Transaction
Question 16 c. SQL command
Answer saved d. Database
Marked out of 1.00
Flag question
Question 20
Question text Answer saved
Marked out of 1.00
TRUE OR FALSE. Remove flag
A FOREIGN KEY is a field in one table that refers to Question text
the PRIMARY KEY in another table.
Which of the following SELECT statement is the
Select one: correct PL/SQL that will display all rows and
True columns?
False
Select one:
Question 17 a. SELECT TABLE PARTS;
Answer saved b. SELECT FROM TABLE PARTS;
Marked out of 1.00
Flag question
c. SELECT * FROM PARTS;
d. SELECT ALL FROM PARTS;
Question text
Question 21
INDEX is an example of _____________________ Answer saved
privilege. Marked out of 1.00
Remove flag
Select one:
a. System Question text
b. None of the choices Display all the records in the employee table. Arrange
c. Object the output in by lastname from A-Z order.
d. Data
Select one:
Question 18 a. SELECT * FROM employees SORT BY lastname
Answer saved b. SELECT * FROM employees ORDER BY lastname
Marked out of 1.00
Flag question
AZ
c. SELECT * FROM employees ORDER BY lastname
Question text d. SELECT * FROM employees SORT BY lastname
ascending
Ms. Ella what to generate the average salary of all
employees whose job function is IT_PROG.  Question 22
Which of the following SQL command will produce the Answer saved
output. Marked out of 1.00
Flag question
Select one:
a. SELECT AVERAGE(salary) FROM employees Question text
WHERE job_id = 'IT_PROG';
Austin David was transferred to Purchasing c. SELECT salary FROM
Department. You are assigned to update the COUNT(employees)WHERE salary < 10000;
database.  d. SELECT COUNT(emp_id) FROM employees
Which of the following SQL command will satisfy the WHERE salary <= 10000;
requirements?
Question 25
Select one: Answer saved
a. UPDATE first_name = ‘David’ AND last_name = Marked out of 1.00
‘Austin’ FROM employees SET department_id = 30 Flag question
b. UPDATE employees SET department_id = 30 Question text
WHERE first_name = ‘David’ AND last_name =
‘Austin’ What privileges that manipulates the content of the
c. UPDATE department_id = 30 WHERE first_name = database objects.
‘David’ AND last_name = ‘Austin’
d. UPDATE employees WHERE department_id = 30 Select one:
SET first_name = ‘David’ AND last_name = ‘Austin’ a. Object Privileges
b. Connection Privileges
Question 23 c. Network Privileges
Answer saved d. System Privileges
Marked out of 1.00
Flag question Question 26
Answer saved
Question text Marked out of 1.00
Remove flag
The General Manager request to the Database
Administrator to generate the total number of parts Question text
and total outstanding balance on hand of every class
in warehouse number 1&2.  Each row of data in a table can be uniquely identified
Which of the following SQL command will generate by a
the required output. Select one:
Select one: a. foreign key
a. SELECT warehouse, class, count(partnum), b. primary key
sum(onhand) GROUP BY warehouse,class HAVING c. local key
warehouse = 1 or warehouse = 2 FROM parts; d. relational key
b. SELECT warehouse, class, count(partnum), e. index key
sum(onhand) GROUP BY warehouse,class WHERE
Question 27
warehouse = 1 or warehouse = 2 FROM parts; Answer saved
c. SELECT warehouse, class, SUM(partnum), Marked out of 1.00
SUM(onhand) FROM parts GROUP BY Flag question
warehouse,class HAVING warehouse = 1 AND
warehouse = 2; Question text
d. SELECT warehouse, class, COUNT(partnum), You want to display all the job position titles whose
SUM(onhand) FROM parts GROUP BY salary is salary from 5,000 to 12,000 arrange from
warehouse,class HAVING warehouse = 1 OR highest to lowest
warehouse = 2;
Select one:
Question 24 a. SELECT job_title FROM employees WHERE
Answer saved salary >= 5000 AND salary <= 10000
Marked out of 1.00
b. SELECT employees_id, job_title FROM employees
Flag question
WHERE salary >= 5000 AND salary <= 10000
Question text c. SELECT job_title FROM jobs WHERE salary >=
5000 AND salary <= 10000
John want to know how many employees receiving d. SELECT job_title FROM jobs WHERE min_salary
salary below 10,000. >= 5000 AND max_salary<= 10000
What SQL command he need to run?
Question 28
Select one: Answer saved
a. SELECT COUNT(salary) FROM employees Marked out of 1.00
WHERE salary < 10,000; Remove flag
b. SELECT COUNT(*) FROM employees WHERE
salary < 10000; Question text
Display all location id between 1000 to 2000. d. SELECT partnum, price, price * 1.10% FROM parts
WHERE warehouse = 3
Select one:
a. DISPLAY location_id FROM departments WHERE Question 31
location_id LING 1000 UP TO 2000 Answer saved
b. SELECT location_id FROM departments WHERE Marked out of 1.00
location_id IN 1000 AND 2000 Remove flag
c. DISPLAY location_id FROM departments WHERE Question text
location_id BETWEEN 1000 TO 2000
d. SELECT location_id FROM departments WHERE You want to display the employee's last name and
location_id BETWEEN 1000 AND 2000 date hired in year 2000 to2006 whose salary is above
5000. Which SQL statement give the required output?
Question 29
Answer saved Select one:
Marked out of 1.00 a. SELECT last_name, hire_date FROM employees
Flag question WHERE hire_date>= 
Question text TO_DATE('01-Jan-2000', 'DD-Mon-YYYYY') AND
hire_date<= TO_DATE('31-Dec-2006', 'DD-Mon-
You want to display the employee's last name and YYYY') AND salary ABOVE 5000;
date hired in year 2002 whose salary is above 5000. b. SELECT last_name, hire_date FROM employees
Which SQL statement give the required output? WHERE hire_date>= 
TO_DATE('01-Jan-2006', 'DD-Mon-RR') AND
Select one: hire_date<= TO_DATE('31-Dec-2006', 'DD-Mon-RR')
a. SELECT last_name, hire_date FROM employees AND salary > 5000;
WHERE hire_date >= TO_DATE('01-Jan-2000', 'DD- c. SELECT last_name, hire_date FROM employees
Mon-YYYYY') AND hire_date <= TO_DATE('31-Dec- WHERE hire_date>= 
2002', 'DD-Mon-YYYY')AND salary ABOVE 5000; TO_DATE('Jan-2000', 'Month-YYYY') AND
b. SELECT last_name, hire_date FROM employees hire_date<= TO_DATE('Dec-2006', 'Month-‘YYYY')
WHERE hire_date >= TO_DATE('01-Jan-2002', 'DD- AND salary > 5,000;
Mon-RR') AND hire_date <= TO_DATE('31-Dec- d. SELECT last_name, hire_date FROM employees
2002', 'DD-Mon-RR') AND salary > 5000; WHERE hire_date>= 
c. SELECT last_name, hire_date FROM employees TO_DATE('2000', 'YYYY') AND hire_date<=
WHERE hire_date >= TO_DATE('2000', 'YYYY') AND TO_DATE('2006', 'YYYY') OR salary > 5000;
hire_date <= TO_DATE('2002', 'YYYY') OR salary >
5000; Question 32
d. SELECT last_name, hire_date FROM employees Answer saved
WHERE hire_date >= TO_DATE('Jan-2000', 'Month- Marked out of 1.00
YYYY') AND hire_date <= TO_DATE('Dec-2002', Remove flag
'Month-‘YYYY') AND salary > 5,000; Question text
Question 30 Which of the following SQL commands will display all
Answer saved the stocks on hand from 10 to 30?
Marked out of 1.00
Flag question Select one:
Question text a. SELECT * FROM parts WHERE BETWEEN
onhand = 10 AND onhand = 30;
There was 10% price increase in the all the parts in b. SELECT * FROM parts WHERE onhand
warehouse number 3. The Store Manager asked the BETWEEN 10 to 30;
Database Administrator to generate a report showing c. SELECT * FROM onhand WHERE parts
the part number, the old and new price.  BETWEEN onhand = 10 AND onhand = 30;
Which of the following SQL statement would satisfy d. SELECT * FROM parts WHERE onhand
the requirement of the Store Manager. BETWEEN 10 AND 30;
e. SELECT * FROM parts WHERE BETWEEN
Select one: onhand>=10 to onhand<=30;
a. SELECT partnum, price, price * 0.1 FROM parts
WHERE warehouse = 3 Question 33
b. SELECT partnum, price, price * 10% FROM parts Answer saved
WHERE warehouse = 3 Marked out of 1.00
c. SELECT partnum, price, price * 1.1 FROM parts Flag question
WHERE warehouse = 3 Question text
ANSI SQL commands cannot be abbreviated. d. SELECT department_id, MAXIMUM(salary) FROM
employees GROUP BY department_id;
Select one:
True Question 37
False Answer saved
Marked out of 1.00
Question 34 Remove flag
Answer saved
Marked out of 1.00 Question text
Remove flag
You want to display all the employee id and the month
Question text an employee was hired.
Which SQL statement give the required output?
Display the lastname of every employee in the
company. Display the output in a single column and Select one:
label it as Fullname a. SELECT employee_id, hire_date,
Format: JuanReyes TO_MONTH(hire_date,'Month') AS "Hired Month",
job_id FROM employees
Select one: b. SELECT employee_id, hire_date,
a. SELECT CONCATENATE(first_name, last_name) TO_DATE(hire_date,'Month') AS "Hired Month",
AS Fullname FROM employees job_id FROM
b. None of the choices c. SELECT employee_id, hire_date,
c. SELECT CONCAT(first_name, last_name) FROM MONTH(hire_date,'Month') AS "Hired Month", job_id
employees FROM employees
d. SELECT CONCAT(first_name, last_name) AS d. SELECT employee_id, hire_date,
Fullname FROM employees TO_CHAR(hire_date,'Month') AS "Hired Month",
job_id FROM employees
Question 35
Answer saved
Question 38
Marked out of 1.00
Remove flag Answer saved
Marked out of 1.00
Question text Flag question

Evaluate the following SQL command Question text


SELECT * FROM jobs WHERE job_title LIKE Which of the following describes the command
'Manager%' below? 
Select one: SELECT * FROM employees WHERE department =
a. The SQL command will display all records in the 60 FOR UPDATE
database Select one:
b. The SQL command will display all employees with a. Locks the rows in the EMPLOYEES table with
Manager position department id is 60.
c. No records will be displayed b. Unlock all records with department id = 60
d. The SQL command will produce an error. c. All users accessing the department id 60 can
accept UPDATE command simultaneously.
Question 36
Answer saved
d. Creates a temporary table with department = 60
Marked out of 1.00
Flag question Question 39
Answer saved
Question text Marked out of 1.00
Flag question
Aldrin wants to know the highest salary in every
department. Which of the following SQL command will Question text
display the required output? Display the employee id, number of years and the
Select one: hiring date of every employee in the company.
a. SELECT department_id, HIGH(salary) FROM Select one:
employees GROUP BY department_id AND salary; a. SELECT employee_id, hire_date,
b. SELECT department_id, HIGHEST(salary) FROM ROUND((SYSDATE - hire_date),0 /365,0) FROM
employees GROUP BY salary; employees;
c. SELECT department_id, MAX(salary) FROM
employees GROUP BY department_id
b. SELECT employee_id, hire_date, b. SELECT SUBSTR(last_name,1,5), first_name
ROUND((SYSDATE - hire_date) /365,0) FROM FROM employees WHERE SUBSTR(first_name,1,1)
employees; = 'N'
c. SELECT employee_id, hire_date, hire_date /365 c. SELECT SUBSTR(surname,1,5), first_name FROM
FROM employees; employees WHERE first_name = 'N'
d. SELECT employee_id, hire_date, hire_date- d. SELECT SUBSTR(surname,1,5), first_name
SYSDATE /365 FROM employees; FROM employees WHERE SUBSTR(first_name,1,1)
IN 'N'
Question 40 e. SELECT SUBSTR(last_name,1,5), first_name
Answer saved FROM employees WHERE first_name IN 'N'
Marked out of 1.00
Flag question
Question 43
Question text Answer saved
Marked out of 1.00
The DBA will create a new user name sales.  Flag question
Which of the following SQL command will perform the Question text
creation?
Display the employee id, salary, number of years and
Select one: the hiring date of every employee in the company.
a. CREATE USER FR0M DB_USER SET
user=’sales’ password=NULL Select one:
b. None of the choices a. SELECT employee_id,salary, hire_date, hire_date-
c. CREATE USERNAME sales SET PASSWORD SYSDATE /365 FROM employees;
default b. SELECT employee_id, salary, hire_date,
d. CREATE sales ACCESS 1234 hire_date /365 FROM employees;
e. CREATE USER sales IDENTIFIED BY 1234 c. SELECT employee_id, salary, hire_date,
ROUND((SYSDATE - hire_date) /365,0) FROM
Question 41 employees;
Answer saved
Marked out of 1.00 Question 44
Flag question
Answer saved
Marked out of 1.00
Question text Flag question
Which of the following SQL command will display the Question text
summary table showing the total quantity on hand per
class. True or False. The AND, OR, NOT are comparison
operators.
Select one:
a. SELECT class, TOTAL(onhand) AS "QTY ON Select one:
HAND" FROM parts GROUP BY class, onhand True
b. SELECT class, onhand AS "QTY ON HAND" False
FROM parts GROUP BY sum(onhand)
c. SELECT class, sum(onhand) AS "QTY ON HAND" Question 45
FROM parts GROUP BY onhand Answer saved
Marked out of 1.00
d. SELECT class, sum(onhand) AS "QTY ON HAND" Flag question
FROM parts GROUP BY class
Question text
Question 42
Answer saved You want to display all the employee id and the month
Marked out of 1.00 an employee was hired excluding employees whose
Remove flag job id is AD_VP. Which SQL statement give the
Question text required output?

Display the first 5 letter in the surname of all the Select one:
employees whose firstname starts with letter 'N' a. SELECT employee_id, hire_date,
MONTH(hire_date,'Month') AS "Hired Month",
Select one:
a. SELECT SUBSTR(last_name,1,5), first_name job_id  FROM employees WHERE job_id EXCLUDE
FROM employees WHERE SUBSTR(first_name,1,1) ('AD_VP');
IN 'N' b. SELECT employee_id, hire_date,
TO_CHAR(hire_date,'Month') AS "Hired Month",
job_id FROM employees WHERE job_id NOT IN b. SELECT department_id, salary FROM employees
('AD_VP'); ORDER BY SUM(salary)
c. SELECT employee_id, hire_date, c. SELECT department_id, salary FROM employees
TO_MONTH(hire_date,'Month') AS "Hired Month", GROUP BY SUM(salary) ORDER BY department_id
job_id FROM employees WHERE job_id NOT d. SELECT department_id, TOTAL(salary) FROM
('AD_VP'); employees GROUP BY department_id
d. SELECT employee_id, hire_date,
TO_DATE(hire_date,'Month') AS "Hired Month", Question 49
job_id FROM employees WHERE job_id NOT = Answer saved
Marked out of 1.00
'AD_VP'; Flag question

Question 46 Question text


Answer saved
Marked out of 1.00 Which of the following SQL commands will display all
Remove flag stocks whose class is HW or AP.
Question text Select one:
Display employee's name and id whose firstname a. SELECT * FROM parts WHERE IN (class = ‘HW’,
starts with letter D and job id is IT_PROG.  class= ‘AP’);
Sort the output by department. b. SELECT ALL FROM class WHERE parts IN =
(‘HW’, ‘AP’);
Select one: c. SELECT * FROM parts WHERE IN class ('HW',
a. SELECT employees FROM employee_id, 'AP');
first_name, last_name WHERE first_name LIKE ‘D%’ d. SELECT ALL FROM parts WHERE IN class =
and job_id = ‘IT_PROG’ ORDER BY department_id (‘HW’, ‘AP’);
b. SELECT employee_id, first_name, last_name e. SELECT * FROM parts WHERE class IN ('HW',
FROM employees WHERE job_id = 'IT_PROG' OR 'AP');
first_name LIKE 'D%' and ORDER BY department_id
c. SELECT employee_id, first_name, last_name Question 50
FROM employees ORDER BY department_id Answer saved
Marked out of 1.00
WHERE first_name LIKE 'D%' and job_id = Flag question
'IT_PROG'
d. SELECT employee_id, first_name, last_name Question text
FROM employees WHERE first_name LIKE 'D%' and
job_id = 'IT_PROG' ORDER BY department_id What is the SQL command to count the number of
records in the employees table?
Question 47
Select one:
Answer saved
Marked out of 1.00 a. SELECT ALL FROM employees
Flag question b. SELECT * FROM employees;
c. SELECT COUNT(*) FROM employees
Question text d. SELECT SUM(*) FROM employees;
TRUE OR FALSE.
An owner has all the privileges on the object.
Select one:
True
False

Question 48
BL-PROG-3114-LAB-1922S
Answer saved PROGG(ORACLE DATABASE)
Marked out of 1.00
Flag question NCIIIP2
Question text
You want to generate the total salary per month of  Dashboard
every department in the company.  My courses
Select one:   BL-PROG-3114-LAB-1922S
a. SELECT department_id, SUM(salary) FROM   Week 3: Use of Single Row Functions
employees GROUP BY department_id   Learning Activity 1
Started on Thursday, 19 December 2019, 3:21 PM
a. SELECT partnum FROM parts WHERE class
State Finished NOT IN ('HW', 'AG', SG') 

Completed on Thursday, 19 December 2019, 3:28 PM


b. SELECT partnum FROM parts WHERE NOT IN
Time taken 6 mins 27 secs class ('HW', 'AG', SG')

Grade 6.00 out of 10.00 (60%) c. SELECT partnum FROM parts WHERE class
Question 1 NOT IN = (‘HW’, AG’, SG’)
Incorrect
d. None of the choices
Mark 0.00 out of 1.00
Question 3
Incorrect

Mark 0.00 out of 1.00

Flag question

Question text

SQL stands for Flag question

Select one: Question text

a. Standard Question Language Create an SQL command to display the name of


the parts, warehouse number, price and the
b. Standard Query Language  available stock on hand whose price is below 500.
Arrange the list by warehouse number and by
c. Structured Query Language class.

d. Sequential Query Level Select one:

e. Structure Query Level a. SELECT partnum, description, warehouse,


onhand, price FROM parts ORDER BY warehouse,
Question 2
class WHERE price < 500; 
Correct

Mark 1.00 out of 1.00 b. SELECT partnum, description, warehouse,


onhand, price WHERE price < 500 ORDER BY
warehouse, class FROM parts

c. SELECT partnum, description, warehouse,


Flag question onhand, price ORDER BY warehouse, class ORDER
BY warehouse, class FROM parts WHERE price <
Question text
500
Display the part number whose class is not HW,
d. SELECT partnum, description, warehouse,
AG or SG.
onhand, price FROM parts ORDER BY warehouse,
Select one: class WHERE 500 < price;
e. SELECT partnum, description, warehouse,
onhand, price FROM parts WHERE price < 500
ORDER BY warehouse, class; Select one:

Question 4
a. Oracle SQL Developer; ANSI SQL Web 
Correct

Mark 1.00 out of 1.00 b. Oracle DB; SQL command line

c. Oracle SQL Developer; SQL command line

d. ANSI SQL Web; Oracle Net SQL


Flag question Feedback
Question text
Your answer is incorrect.
Display the last day of the month and the hiring Question 6
date when the employees are hired in the Correct
company. Mark 1.00 out of 1.00

Select one:

a. SELECT LASTDAY(hire_date), hire_date FROM


employees;
Flag question
b. SELECT LAST(hire_date), hire_date FROM
Question text
employees;
Display the first 3 letter in the first name of all the
c. SELECT LAST_DAY(hire_date), hire_date FROM
employees.
employees; 
Select one:
d. SELECT LDAY(hire_date), hire_date FROM
employees; a. SELECT SUBSTRING(first_name,1,3) FROM
employees;
Question 5
Incorrect
b. SELECT SUBSTRING(first_name,1,3) FROM
Mark 0.00 out of 1.00
employees;

c. SELECT SUBSTR(first_name,3) FROM


employees;

Flag question d. SELECT SUBSTR(first_name,1,3) FROM


employees; 
Question text
Question 7
1.       The two development environments of Oracle Correct
are _______________ and ______________.
Mark 1.00 out of 1.00
b. SELECT * FROM EMPLOYEES WHERE job_id
LIKE '*ACCOUNT%';

c. SELECT * FROM EMPLOYEES WHERE job_id


Flag question
LIKE '_ACCOUNT_';
Question text
d. SELECT * FROM EMPLOYEES WHERE job_id
Which of the following SQL commands will LIKE '_ACCOUNT%';
display all stocks whose class is HW or AP.
e. SELECT * FROM EMPLOYEES WHERE job_id
Select one:
LIKE '%*ACCOUNT*%';
a. SELECT * FROM parts WHERE class IN ('HW', Question 9
'AP'); Correct

Mark 1.00 out of 1.00


b. SELECT ALL FROM class WHERE parts IN =
(‘HW’, ‘AP’);

c. SELECT ALL FROM parts WHERE IN class =


(‘HW’, ‘AP’);
Flag question

d. SELECT * FROM parts WHERE IN class ('HW', Question text


'AP'); 
Display employee's name and id whose firstname
e. SELECT * FROM parts WHERE IN (class = ‘HW’, starts with letter D and job id is SA_REP. Sort the
class= ‘AP’); output by department.
Question 8 Select one:
Correct

Mark 1.00 out of 1.00 a. SELECT employees FROM employee_id,


first_name, last_name WHERE first_name LIKE ‘D
%’ and job_id = ‘IT_PROG’ ORDER BY
department_id

Flag question b. SELECT employee_id, first_name, last_name


FROM employees WHERE job_id = 'IT_PROG' OR
Question text
first_name LIKE 'D%' and ORDER BY
department_id
Display all employees whose job id contains the
word 'ACCOUNT'.
c. SELECT employee_id, first_name, last_name
Select one: FROM employees WHERE first_name LIKE 'D%'
and job_id = 'IT_PROG' ORDER BY department_id 
a. SELECT * FROM EMPLOYEES WHERE job_id
LIKE '%ACCOUNT%';  d. 'IT_PROG' OR first_name LIKE 'D%' and ORDER
BY department_id
  Week 3: Use of Single Row Functions
e. SELECT employee_id, first_name, last_name
  Learning Activity 1
FROM employees ORDER BY department_id
WHERE first_name LIKE 'D%' and job_id = Started on Thursday, 19 December 2019, 3:3
'IT_PROG'
State Finished
Question 10
Incorrect Completed on Thursday, 19 December 2019, 3:3
Mark 0.00 out of 1.00
Time taken 2 mins 22 secs

Grade 8.00 out of 10.00 (80%)

Question 1
Correct
Flag question
Mark 1.00 out of 1.00
Question text

Which of the following SELECT statement is the


correct report that will rename the column
DESCRIPTION to TITLE, PARTNUM to ID and Flag question
ONHAND to STOCK?
Question text
Select one:
List all the employee_id of all employees whose
a. SELECT DESCRIPTION RENAME AS TITLE, salary is 5000 and below and belong to
PARTNUM RENAME AS ID, ONHAND RENAME department 60 or 100.
AS STOCK FROM PARTS; 
Select one:
b. SELECT DESCRIPTION AS 'TITLE', PARTNUM AS
a. SELECT employee_id,salary, department_id
'ID', ONHAND AS 'STOCK' FROM PARTS;
FROM employees WHERE salary < 5000 AND
c. SELECT DESCRIPTION AS TITLE, PARTNUM AS department_id IN (60,100) 
ID, ONHAND AS STOCK FROM PART;
b. SELECT employees FROM employee_id,salary,
d. SELECT DESCRIPTION NEW AS TITLE, department_idWHERE salary < 5000 AND
PARTNUM NEW AS ID, ONHAND NEW AS STOCK department_id IN (60,100)
FROM PARTS;
c. SELECT employee_id FROM employee WHERE
salary < 5000 AND department_id IN ('60,'100')
BL-PROG-3114-LAB-1922S
d. SELECT employee_id,salary, department_id
PROGG(ORACLE DATABASE)
FROM employees WHERE salary < 5000 AND
NCIIIP2 department_id IN (60 OR 100)

Question 2
 Dashboard Correct
 My courses
Mark 1.00 out of 1.00
  BL-PROG-3114-LAB-1922S
c. SELECT TOTAL(last_name) FROM employees;

d. SELECT TOTALCHAR(last_name),LAST_NAME
FROM EMPLOYEES;
Flag question
Question 4
Question text
Correct

Which of the following SQL commands will Mark 1.00 out of 1.00
display all the stocks on hand from 10 to 30?

Select one:

a. SELECT * FROM parts WHERE onhand


Flag question
BETWEEN 10 to 30;
Question text
b. SELECT * FROM parts WHERE BETWEEN
onhand>=10 to onhand<=30; Display the name, jobs id and salary of the all the
employees whose department id is 100 and
c. SELECT * FROM parts WHERE onhand salary is below 8000. Arrange the output by
BETWEEN 10 AND 30;  salary in ascending order.

d. SELECT * FROM onhand WHERE parts Select one:


BETWEEN onhand = 10 AND onhand = 30;
a. SELECT name, salary FROM employees WHERE
e. SELECT * FROM parts WHERE BETWEEN department_id = 100 AND salary < 8000 ORDER
onhand = 10 AND onhand = 30; BY salary ASC

Question 3 b. SELECT first_name, last_name, salary FROM


Correct
employees ORDER BY salary WHERE
Mark 1.00 out of 1.00 department_id = 100 AND salary > 8000

c. SELECT first_name, last_name, salary FROM


employees WHERE salary < 8000 AND
department_id = 100 AND ORDER BY
Flag question department_id

Question text
d. SELECT first_name, last_name, salary FROM
employees WHERE department_id = 100 AND
Display the total number of characters of the last
salary < 8000 ORDER BY salary 
name of all the employees.

Select one: e. SELECT name FROM employees WHERE salary


< 8000 AND department_id = 100 AND ORDER
a. SELECT LEN(last_name) FROM employees; BY department_id

b. SELECT LENGTH(last_name) FROM employees; 


f. SELECT employees FROM first_name, c. SELECT employee_id, salary, salary * 1.50% AS
last_name, salary WHERE department_id = 100 Bonus FROM employees
AND salary < 8000 ORDER BY salary ASC
d. SELECT employee_id, salary, salary * 150% AS
Question 5
"Bonus" FROM employees
Incorrect

Mark 0.00 out of 1.00 Question 7


Correct

Mark 1.00 out of 1.00

Flag question

Question text
Flag question

Using Data Manipulation Language, you can ADD Question text


columns in the table.
Ronnie is the stockman in the warehouse of ATR
Select one: Corporation. The General Manager wants to
know the parts whose price is above 10000 and
True 
above. Which of the following SQL command
False that Ronnie will run to generate the list.

Question 6
Select one:
Correct
a. SELECT * FROM parts WHERE price > 10000;
Mark 1.00 out of 1.00

b. SELECT * FROM parts WHERE price <= 10000;

c. SELECT * FROM parts WHERE price >= 10000; 

Flag question d. SELECT parts FROM price WHERE price >=


10000;
Question text
e. SELECT ALL FROM parts WHERE price >
Every employee will get a bonus of 150% of
‘10000’;
his/her current salary. Display the employee id,
salary and the bonus of every employee. Label
f. SELECT ALL FROM parts WHERE price < 10000;
the computed bonus with Bonus
Question 8
Select one: Correct

Mark 1.00 out of 1.00


a. SELECT employee_id, salary, salary * 1.5 AS
Bonus FROM employees 

b. SELECT employee_id, salary, salary * 150 AS


"Bonus" FROM employees
Question 10
Incorrect

Mark 0.00 out of 1.00

Flag question

Question text

Display all the records sorted by price from most


Flag question
expensive to the cheapest parts.
Question text
Select one:
Which of the following is NOT a Data
a. SELECT * FROM parts SORT BY price Manipulation Language?

b. SELECT ALL FROM parts SORT BY price Select one:


HIGHEST
a. SELECT
c. SELECT ALL FROM price SORT BY parts
HIGHETS b. CREATE

d. SELECT * FROM parts ORDER BY price DESC  c. INSERT

e. SELECT * FROM parts ORDER BY price d. DELETE 

f. SELECT ALL FROM parts ORDER BY price e. UPDATE

g. SELECT * FROM parts SORT BY price DESC

Question 9
Correct BL-PROG-3114-LAB-1922S
Mark 1.00 out of 1.00
PROGG(ORACLE DATABASE)
NCIIIP2

 Dashboard
 My courses
Flag question   BL-PROG-3114-LAB-1922S
  Week 3: Use of Single Row Functions
Question text   Learning Activity 1

You can relate data to multiple tables using a Started on Thursday, 19 December 2019, 3:3
foreign key.
State Finished
Select one:
Completed on Thursday, 19 December 2019, 3:3
True 
Time taken 1 min 35 secs
False Grade 6.00 out of 10.00 (60%)
b. SELECT employee_id, salary FROM employees
Question 1 WHERE salary *12 >= 100000 AND salary *12 <=
Correct 200000 ORDER BY salary
Mark 1.00 out of 1.00
c. SELECT employee_id, salary, salary *12 FROM
employees WHERE 12* salary = 100000 AND 12
*salary = 200000 ORDER BY salary

d. SELECT employee_id, salary FROM employees


Flag question
WHERE salary >= 100000 AND salary <= 200000
Question text ORDER BY salary

Which of the following SELECT statement is the Question 3


Correct
correct PL/SQL that will display all rows and
columns? Mark 1.00 out of 1.00

Select one:

a. SELECT ALL FROM PARTS;

b. SELECT FROM TABLE PARTS; Flag question

Question text
c. SELECT * FROM PARTS; 
Display the employee id and the last name of
d. SELECT TABLE PARTS; every employee in the company whose salary is
Question 2 between 5000 to 10000. Display the output in a
Correct single column with the format 100 : King Label
Mark 1.00 out of 1.00
the column as Employee

Select one:

a. SELECT CONCAT(CONCAT(employee_id, ':'),


last_name) AS Employee FROM employees
Flag question WHERE salary >= 5000 AND salary <= 10000 
Question text
b. SELECT CONCAT(CONCAT(employee_id, ':'),
Display all the employee's id and salary whose last_name) AS Employee, salary FROM employees
annual salary is from 100,000 to 200,000. Arrange WHERE salary >= 5000 AND salary <= 10000
the output by salary in descending order.
c. SELECT CONCAT(employee_id, ':', last_name)
Select one: AS Employee, salary FROM employees WHERE
salary BETWEEN 5000 TO 10000
a. SELECT employee_id, salary FROM employees
WHERE salary *12 >= 100000 AND salary *12 <= d. SELECT CONCAT(employee_id,last_name) AS
200000 ORDER BY salary desc  Employee FROM employees WHERE salary >5000
AND 10000
Question 4
a. SELECT ROUND(salary *12 , 2) /12 FROM
Incorrect
employees;
Mark 0.00 out of 1.00

b. SELECT (ROUND(salary,2) )/12 FROM


employees;

c. SELECT ROUND( (salary/12),2 ) FROM


Flag question employees; 

Question text
d. SELECT RND(salary,2)/12 FROM employees;

Which of the following SELECT statement is the


e. SELECT RND( (salary/12),2 ) FROM employees;
correct report that will display the unique value
for WAREHOUSE renames the column as "No. of Question 6
Incorrect
Available Warehouse".
Mark 0.00 out of 1.00
Select one:

a. SELECT DISTINCT 'WAREHOUSE AS' "No. of


available warehouse" FROM PARTS; 

b. SELECT DISTINCT WAREHOUSE AS No. of Flag question

available warehouse FROM PARTS; Question text

c. SELECT DISTINCT COLUMN WAREHOUSE AS Which of the following SELECT statement is the
"No. of available warehouse" FROM PARTS; correctreport that will combine the column
PARTNUM and DESCRIPTION put a literal
d. SELECT DISTINCT WAREHOUSE AS "No. of character string "belongs to" in between the two
available warehouse" FROM PARTS; columns then rename the column as "NUMBER
Question 5 TITLE". Note put space before and after the
Correct character literal string to avoid no spaces in the
Mark 1.00 out of 1.00 report.

Select one:

a. SELECT (PARTNUM|| THAT BELONGS TO ||


DESCRIPTION) AS "NUMBER TITLE" FROM
Flag question PARTS; 
Question text
b. SELECT (;PARTNUM'||' THAT BELONGS TO
Display the montly salary of every employee. '||'DESCRIPTION;) AS "NUMBER TITLE" FROM
Round the salary in 2 decimal places. PARTS;

Select one: c. SELECT (PARTNUM||' THAT BELONGS TO '||


DESCRIPTION) AS "NUMBER TITLE" FROM PARTS;
d. SELECT (PARTNUM||' THAT BELONGS TO '||
DESCRIPTION) AS NUMBER TITLE FROM PARTS;

Question 7
Incorrect Flag question

Mark 0.00 out of 1.00 Question text

Which of the following SELECT statement is the


correct PL/SQL that willcreate a report that will
add 10% increase in PRICE? List only the column
Flag question DESCRIPTION, CLASS and PRICE.

Question text Select one:

Display all employees id and remainder of the a. SELECT PRICE*0.10 FROM PARTS; 
his/her salary after it is divided by 3,000 for all
employees with the job id of IT_PROG. b. SELECT PRICE*10, DESCRIPTION, CLASS FROM
PARTS;
Select one:
c. SELECT PRICE*0.10, DESCRIPTION, CLASS
a. SELECT employee_id, job_id, salary, salary/3000 FROM PARTS;
FROM employees WHERE job_id = 'IT_PROG' 
d. SELECT PRICE*10+PRICE, DESCRIPTION, CLASS
b. SELECT employee_id, job_id, salary, FROM PARTS;
REM(salary/3000) FROM employees WHERE
job_id = 'IT_PROG' Question 9
Correct

c. SELECT employee_id, job_id, salary FROM Mark 1.00 out of 1.00


employees WHERE job_id = 'IT_PROG' AND
MOD(salary, 3000)

d. SELECT employee_id, job_id, salary,


MOD(salary, 3000) FROM employees WHERE Flag question
job_id = 'IT_PROG'
Question text
e. SELECT employee_id, job_id, salary FROM
Display the employee id, number of years and
employees WHERE job_id = 'IT_PROG' AND
the hiring date of every employee in the
salary/3000
company.
Question 8
Incorrect Select one:

Mark 0.00 out of 1.00


a. SELECT employee_id, hire_date,
ROUND((SYSDATE - hire_date),0 /365,0) FROM
employees;
b. SELECT employee_id, hire_date, hire_date-
SYSDATE /365 FROM employees; BL-PROG-3114-LAB-1922S
PROGG(ORACLE DATABASE)
c. SELECT employee_id, hire_date, hire_date /365
NCIIIP2
FROM employees;

d. SELECT employee_id, hire_date,  Dashboard


ROUND((SYSDATE - hire_date) /365,0) FROM  My courses
employees;    BL-PROG-3114-LAB-1922S
  Week 3: Use of Single Row Functions
Question 10   Learning Activity 1
Correct
Started on Thursday, 19 December 2019, 3:38 P
Mark 1.00 out of 1.00

State Finished

Completed on Thursday, 19 December 2019, 3:40 P

Time taken 1 min 41 secs


Flag question
Grade 6.00 out of 10.00 (60%)
Question text
Question 1
Incorrect
Display part number description and warehouse
number whose part number starts with letter K. Mark 0.00 out of 1.00

Select one:

a. SELECT partnum, description, warehouse


FROM parts WHERE partnum LIKE 'K%'; 
Flag question

b. SELECT partnum, description, warehouse Question text


FROM parts WHERE partnum = LIKE ‘K%’;
Using CREATE SQL Command, you can add new
c. SELECT * FROM parts WHERE partnum LIKE records in the table.
'K_';
Select one:

d. SELECT partnumber, description, warehouse


True 
FROM parts WHERE partnum LIKE 'K*';
False
e. SELECT partnum, description, warehouse
FROM parts WHERE partnum LIKE '*K*'; Question 2
Correct

f. SELECT * FROM parts WHERE partnum LIKE 'K Mark 1.00 out of 1.00
%';

g. SELECT partnumber, description, warehouse


FROM parts WHERE partnum = LIKE ‘K%’;
Flag question Flag question

Question text Question text

ANSI SQL commands cannot be abbreviated. Which of the following SELECT statement is the
correct PL/SQL that will display eliminate the
Select one:
duplicate rows for column class and warehouse.
True  Select one:

False a. SELECT DISTINCT CLASS, DISTINCT


Question 3
WAREHOUSE FROM PARTS; 
Correct
b. SELECT DISTINCT CLASS, WAREHOUSE FROM
Mark 1.00 out of 1.00
PARTS;

c. SELECT DISTINCT CLASS AND WAREHOUSE


FROM PARTS;

Flag question d. SELECT DISTINCT CLASS AND DISTINCT


Question text WAREHOUSE FROM PARTS;

Question 5
Each row of data in a table can be uniquely Correct
identified by a
Mark 1.00 out of 1.00
Select one:

a. primary key 

b. local key
Flag question

c. index key Question text

d. foreign key Display the first 5 letter in the surname of all the
employees whose firstname starts with letter 'D'
e. relational key
Select one:
Question 4
Incorrect a. SELECT SUBSTR(surname,1,5), first_name
Mark 0.00 out of 1.00 FROM employees WHERE SUBSTR(first_name,1,1)
IN 'D'

b. SELECT SUBSTR(last_name,1,5), first_name


FROM employees WHERE first_name IN 'D'
c. SELECT SUBSTR(last_name,1,5), first_name Which of the following SELECT statement is the
FROM employees WHERE SUBSTR(first_name,1,1) correctreport the will merge the column CLASS
IN 'D' and PRICE rename the COLUMN as "CLASS
PRICE".
d. SELECT SUBSTR(surname,1,5), first_name Select one:
FROM employees WHERE first_name = 'D'
a. SELECT (CLASS||PRICE) AS CLASS PRICE FROM
e. SELECT SUBSTR(last_name,1,5), first_name PARTS; 
FROM employees WHERE SUBSTR(first_name,1,1)
= 'D'  b. SELECT ('CLASS'||'PRICE') AS "CLASS PRICE"
FROM PARTS;
Question 6
Correct
c. SELECT (CLASS||PRICE) CLASS PRICE FROM
Mark 1.00 out of 1.00
PARTS;

d. SELECT (CLASS||PRICE) AS "CLASS PRICE"


FROM PARTS;

Question 8
Flag question
Correct
Question text
Mark 1.00 out of 1.00

Which of the following is an Oracle Proprietary


Commands

Select one:
Flag question
a. SQL *Plus 
Question text
b. SQL
Command use to display table structure
c. MySQL Plus Select one:

d. ANSI SQL a. DESCRIBE 


Question 7
Incorrect b. DISPLAY TABLE

Mark 0.00 out of 1.00


c. DISPLAY

d. DISPLAY STRUCTURE

Question 9
Incorrect
Flag question
Mark 0.00 out of 1.00
Question text
Firstname example Santos, Arnold. Display the
output in a single column. Label the column as
Fullname

Select one:
Flag question
a. SELECT CONCAT(last_name, ',', first_name) AS
Question text
Fullname FROM employees 
Which of the following is a Data Definition b. SELECT CONCAT(last_name, first_name) FROM
Language? employees

Select one: c. SELECT CONCAT(CONCAT(last_name, ','),


first_name) AS Fullname FROM employees;
a. GRANT  d. SELECT CONCAT(last_name, first_name) AS
Fullname FROM employees;
b. REVOKE
The following are capabilities of SQL SELECT
c. MERGE Select one:
a. Grant priveledge, Add user
d. DROP
b. Projection, Selection, Join records
e. COMMIT c. Create records, Remove Table, Edit record 
Question 10 d. Update, Delete, Add
Correct
Which of the following SELECT statement is the
Mark 1.00 out of 1.00
correct PL/SQL that willcreate a report specifying
only the column PRICE, ONHAND and
DESCRIPTION?

Select one:

Flag question a. SELECT (ONHAND||PRICE ||DESCRIPTION


FROM PARTS; 
Question text
b. SELECT PRICE, ONHAND, DESCRIPTION FROM
Which of the following is the correct report that PARTS;
will display the CLASS from table PARTS. c. SELECTONHAND,PRICE ,DESCRIPTION FROM
PARTS;
Select one:
d. SELECTONHAND,PRICE DESCRIPTION FROM
a. SELECT * CLASS FROM PARTS; PARTS ORDER BY ONHAND;

b. SELECT 'CLASS' FROM PARTS;

c. SELECT CLASS FROM PARTS; 


BL-PROG-3114-LAB-1922S
PROGG(ORACLE DATABASE)
d. SELECT CLASS AS CLASS FROM PARTS; NCIIIP2
Create a SQL script to display the fullname of
evey employee with the format Lastname,  Dashboard
 My courses
  BL-PROG-3114-LAB-1922S
  Week 5: Reporting Aggregated Data Using
Group Functions
  Long Quiz 1
Flag question

Started on Question text


Thursday, 19 December 2019, 7:24 PM

State Finished
You want to display the employee id, date hired
Completed on of all employees whose hired date is September.
Thursday, 19 December 2019, 7:27 PM

Time taken 3 mins 9 secs Which SQL statement give the required output?

Grade 16.00 out of 20.00 (80%)

Question 1
Correct

Mark 1.00 out of 1.00

Select one:

Flag question a. SELECT employee_id, hire_date,


Question text TO_DATE(hire_date, 'Month') AS "Hired Month"
FROM employees WHERE TO_DATE(hire_date,
Aldrin wants to know the highest salary in every 'MON') = 'SEP' 
department. Which of the following SQL
command will display the required output? b. SELECT employee_id, hire_date,
TO_CHAR(hire_date, 'Month') AS "Hired Month"
Select one: FROM employees WHERE TO_CHAR(hire_date,
'MON') = 'SEP'
a. SELECT department_id, MAXIMUM(salary)
FROM employees GROUP BY department_id; c. SELECT employee_id, hire_date,
TO_CHAR(hire_date, 'Month') AS "Hired Month"
b. SELECT department_id, HIGH(salary) FROM
FROM employees WHERE TO_CHAR(hire_date,
employees GROUP BY department_id AND salary;
'Month') = TO_DATE('September')
c. SELECT department_id, MAX(salary) FROM
d. SELECT employee_id, hire_date,
employees GROUP BY department_id 
TO_CHAR(hire_date, 'Month') AS "Hired Month"
FROM employees WHERE TO_DATE(hire_date,
d. SELECT department_id, HIGHEST(salary) FROM
'Month') = TO_DATE(‘09’)
employees GROUP BY salary;
Question 3
Question 2
Correct
Incorrect
Mark 1.00 out of 1.00
Mark 0.00 out of 1.00
Mark 1.00 out of 1.00

Flag question

Question text Flag question

Question text
You want to display the employee's last name
whose salary is below 10,000.  You want to display the employee's id and
Which SQL statement give the required output formatted date hired as shown below. 
format of the salary? Which SQL statement give the required output?
Required output : Required output :

Select one: Select one:

a. SELECT last_name, TO_INTEGER(salary, a. SELECT employee_id,


$999,999.99) AS "MONTHLY SALARY" FROM format(TO_DATE(hire_date, 'Month DD, YYYY'))
employees WHERE salary < 10000 AS "Hired Date" FROM employees;

b. SELECT last_name, TO_INT(salary, b. SELECT employee_id, TO_CHAR(hire_date,


'$999,999.99') AS "MONTHLY SALARY" FROM 'Month DD, YYYY') AS "Hired Date" FROM
employees WHERE salary < 10,000 employees;

c. SELECT last_name, TO_NUMBER(salary, c. SELECT employee_id, TO_DATE (hire_date,


'$999,999.99') AS "MONTHLY SALARY" FROM 'format Month DD, YYYY') AS "Hired Date" FROM
employees WHERE salary < 10,000 employees;

d. SELECT last_name, TO_CHAR(salary, d. SELECT employee_id, TO_CHAR(hire_date,


'$999,999.99') AS "MONTHLY SALARY" FROM 'fmMonth DD, YYYY') AS "Hired Date" FROM
employees WHERE salary < 10000  employees; 
Question 4 Question 5
Correct Correct
Mark 1.00 out of 1.00 John want to know how many part items are
there in warehouse number 3.

What SQL command he need to run?


Select one:
Flag question
a. SELECT COUNT(*) FROM parts WHERE
Question text
warehouse = 3; 

You want to display all the employee id and the


b. SELECT ALL FROM COUNT(parts) WHERE
month an employee was hired excluding
warehouse = 3;
employees whose job id is AD_VP. Which SQL
statement give the required output? c. SELECT * FROM COUNT(parts) WHERE
Select one: warehouse = 3;

a. SELECT employee_id, hire_date, d. SELECT partnum FROM COUNT(parts)WHERE


TO_DATE(hire_date,'Month') AS "Hired Month", warehouse = 3;
job_id FROM employees WHERE job_id NOT = Question 7
'AD_VP'; Correct

Mark 1.00 out of 1.00


b. SELECT employee_id, hire_date,
TO_CHAR(hire_date,'Month') AS "Hired Month",
job_id FROM employees WHERE job_id NOT IN
('AD_VP'); 

Flag question
c. SELECT employee_id, hire_date,
MONTH(hire_date,'Month') AS "Hired Month", job_id  Question text
FROM employees WHERE job_id EXCLUDE ('AD_VP');
What is the SQL command to display the date of
d. SELECT employee_id, hire_date, the first employee that was hired?
TO_MONTH(hire_date,'Month') AS "Hired
Month", job_id FROM employees WHERE job_id Select one:
NOT ('AD_VP');
a. SELECT FIRST(hire_date) FROM employees;
Question 6
Correct b. SELECT hire_date FROM employees WHERE
Mark 1.00 out of 1.00 FIRST(hire_date );

c. SELECT hire_date FROM employees WHERE


TO_CHAR(hire_date) = ‘FIRST’;

d. SELECT MIN(hire_date) FROM employees; 


Flag question
Question 8
Question text
Correct

Mark 1.00 out of 1.00


b. SELECT department_id, TOTAL(salary) FROM
employees GROUP BY department_id

c. SELECT department_id, SUM(salary) FROM


Flag question
employees GROUP BY department_id 
Question text
d. SELECT department_id, salary FROM
Aldrin wants to know the outstanding total employees ORDER BY SUM(salary)
balance on hand on every class per warehouse.
Question 10
Select one: Correct

Mark 1.00 out of 1.00


a. SELECT TOTAL(warehouse), TOTAL(class),
TOTAL(onhand) FROM parts GROUP BY
warehouse, class

b. SELECT warehouse, class, onhand FROM parts


Flag question
GROUP BYsum(warehouse), sum(class);
Question text
c. SELECT warehouse, class, sum(onhand) FROM
parts GROUP BY warehouse, class  There was 10% price increase in the all the parts
in warehouse number 3. The Store Manager
d. SELECT warehouse, class, onhand FROM parts asked the Database Administrator to generate a
GROUP BY warehouse, class report showing the part number, the old and new
Question 9
price. 
Correct
Which of the following SQL statement would
Mark 1.00 out of 1.00 satisfy the requirement of the Store Manager.
Select one:

a. SELECT partnum, price, price * 0.1 FROM parts


WHERE warehouse = 3
Flag question
b. SELECT partnum, price, price * 1.1 FROM parts
Question text
WHERE warehouse = 3 
The General Manager request to the Database
c. SELECT partnum, price, price * 1.10% FROM
Administrator to generate the total salary per
parts WHERE warehouse = 3
month of every department in the company.

Select one: d. SELECT partnum, price, price * 10% FROM


parts WHERE warehouse = 3
a. SELECT department_id, salary FROM
Question 11
employees GROUP BY SUM(salary) ORDER BY
Incorrect
department_id
Mark 0.00 out of 1.00
b. SELECT partnum FROM parts WHERE partnum
= ‘%9%’

c. SELECT partnum FROM parts WHERE partnum


Flag question
BETWEEN = ‘%9%’
Question text
d. SELECT * FROM parts WHERE partnum IN
Display a summary table of the total quantity on ('%9%')
hand above 50 very class per warehouse
Question 13
Select one: Correct

Mark 1.00 out of 1.00


a. SELECT warehouse, class, sum(onhand) FROM
parts GROUP BY warehouseWHERE
SUM(ONHAND) > 50 

b. SELECT warehouse, class, sum(onhand) FROM


Flag question
parts WHERE SUM(ONHAND) > 50
Question text
c. SELECT warehouse, class, sum(onhand) FROM
parts GROUP BY warehouse,class HAVING You want to display the last name and the year
SUM(ONHAND) > 50 when an employee was hired whose job id is
IT_PROG.
d. SELECT warehouse, class, sum(onhand) FROM
parts GROUP BY warehouse HAVING Which SQL statement give the required output?
SUM(ONHAND) > 50 Select one:

Question 12
a. SELECT last_name, YEAR(hire_date,'YYYY')
Correct
FROM employees WHERE job_id = ‘IT_PROG’;
Mark 1.00 out of 1.00
b. SELECT last_name, YEAR(hire_date') FROM
employees WHERE job_id = ‘IT_PROG’;

c. SELECT last_name, TO_YEAR(hire_date,'YYYY')


Flag question FROM employees WHERE job_id = ‘IT_PROG’;

Question text d. SELECT last_name, TO_CHAR(hire_date,'YYYY')


FROM employees WHERE job_id = ‘IT_PROG’; 
Which of the following SQL command will display
all records with part number contains the number Question 14
9? Correct

Mark 1.00 out of 1.00


Select one:

a. SELECT * from parts WHERE partnum LIKE


'%9%' 
warehouse,class HAVING warehouse = 1 OR
warehouse = 2; 

b. SELECT warehouse, class, count(partnum),


Flag question sum(onhand) GROUP BY warehouse,class
Question text HAVING warehouse = 1 or warehouse = 2 FROM
parts;
What will be the output of the following SQL? 
c. SELECT warehouse, class, SUM(partnum),
SELECT * FROM parts WHERE (warehouse = 1 or
SUM(onhand) FROM parts GROUP BY
warehouse = 2) AND class IN ('HW', 'AP') AND
warehouse,class HAVING warehouse = 1 AND
(price > 200 AND price < 500);
warehouse = 2;
Select one:
d. SELECT warehouse, class, count(partnum),
a. Invalid SQL command sum(onhand) GROUP BY warehouse,class WHERE
warehouse = 1 or warehouse = 2 FROM parts;
b. Error
Question 16
c. 0 rows returned Correct

Mark 1.00 out of 1.00


d. 2 rows returned 

e. 7 rows returned

Question 15
Correct
Flag question
Mark 1.00 out of 1.00
Question text

You want to display the employee's last name


and date hired in year 2002 whose salary is above
5000.
Flag question
Which SQL statement give the required output?
Question text
Select one:
The General Manager request to the Database
a. SELECT last_name, hire_date FROM employees
Administrator to generate the total number of
WHERE hire_date >= TO_DATE('2000', 'YYYY')
parts and total outstanding balance on hand of
AND hire_date <= TO_DATE('2002', 'YYYY') OR
every class in warehouse number 1&2. 
salary > 5000;
Which of the following SQL command will
generate the required output. b. SELECT last_name, hire_date FROM employees
Select one: WHERE hire_date >= TO_DATE('01-Jan-2000',
'DD-Mon-YYYYY') AND hire_date <=
a. SELECT warehouse, class, COUNT(partnum), TO_DATE('31-Dec-2002', 'DD-Mon-YYYY')AND
SUM(onhand) FROM parts GROUP BY salary ABOVE 5000;
c. SELECT last_name, hire_date FROM employees You want to display the employee's last name
WHERE hire_date >= TO_DATE('Jan-2000', hired from year 2000 to 2002.
'Month-YYYY') AND hire_date <= TO_DATE('Dec- Which SQL statement give the required output?
2002', 'Month-‘YYYY') AND salary > 5,000;
Select one:

d. SELECT last_name, hire_date FROM employees


a. SELECT last_name, hire_date FROM employees
WHERE hire_date >= TO_DATE('01-Jan-2002',
WHERE hire_date>= TO_DATE('2000', 'YYYY')
'DD-Mon-RR') AND hire_date <= TO_DATE('31-
AND hire_date<= TO_DATE('2002', 'YYYY') 
Dec-2002', 'DD-Mon-RR') AND salary > 5000; 

Question 17 b. SELECT last_name, hire_date FROM employees


Correct WHERE hire_date>= TO_DATE('01-Jan-2000',
Mark 1.00 out of 1.00
'DD-Mon-RR') AND hire_date<= TO_DATE('31-
Dec-2002', 'DD-Mon-RR')

c. SELECT last_name, hire_date FROM employees


WHERE hire_date>= TO_DATE('01-Jan-2000',
'DD-Mon-YYYYY') AND hire_date<=
Flag question
TO_DATE('31-Dec-2002', 'DD-Mon-YYYY')
Question text
d. SELECT last_name, hire_date FROM employees
What will be the output of the SQL command? WHERE hire_date>= TO_DATE('Jan-2000',
SELECT SUM(onhand) FROM PARTS where class 'Month-YYYY') AND hire_date<= TO_DATE('Dec-
= 'HW' OR class = 'AP' AND warehouse = 1; 2002', 'Month-‘YYYY')
Select one: Question 19
Incorrect
a. 85
Mark 0.00 out of 1.00

b. 178

c. 44

d. 137  Flag question

Question 18 Question text


Incorrect
Display the warehouse number, class, highest
Mark 0.00 out of 1.00
price & lowest price, total on hand balance
whose class is AP.

Sort the output by warehouse number.


Select one:
Flag question

Question text a. SELECT warehouse, class, MAX(price),


MIN(PRICE), SUM(onhand)
FROM parts
GROUP BY warehouse, class employees WHERE salary < 10,000WHERE
ORDER BY warehouse; last_name = ‘K%’
WHERE class = 'AP' 
b. SELECT last_name, TO_CHAR(salary,
b. SELECT warehouse, class, MAX(price), '$999,999.99') AS "MONTHLY SALARY" FROM
MIN(PRICE), sum(onhand) employees WHERE salary < 10000WHERE
FROM parts last_name LIKE ‘K%’ 
WHERE class = 'AP'
GROUP BY warehouse, class c. SELECT last_name, TO_INT(salary,
ORDER BY warehouse; '$999,999.99') AS "MONTHLY SALARY" FROM
employees WHERE salary < 10,000 WHERE
c. SELECT warehouse, class, HIGH(price), last_name STARTS 'K%'
LOW(PRICE), SUM(onhand)
FROM parts d. SELECT last_name, TO_INTEGER(salary,
GROUP BY warehouse $999,999.99) AS "MONTHLY SALARY" FROM
WHERE class = 'AP' employees WHERE salary < 10000 WHERE
ORDER BY warehouse, class; last_name IN 'K%'

d. SELECT warehouse, class, MAX(price),


MIN(PRICE), sum(onhand) BL-PROG-3114-LAB-1922S
FROM parts PROGG(ORACLE DATABASE)
WHERE class = 'AP' NCIIIP2
GROUP BY warehouse, class, price
ORDER BY warehouse, class
 Dashboard
Question 20  My courses
Correct   BL-PROG-3114-LAB-1922S
  Week 5: Reporting Aggregated Data Using
Mark 1.00 out of 1.00
Group Functions
  Long Quiz 1

Started on Thursday, 19 December 2019, 7:31 P

State Finished
Flag question
Completed on Thursday, 19 December 2019, 7:35 P
Question text
Time taken 3 mins 55 secs
You want to display the employee’s last name whose
Grade 19.00 out of 20.00 (95%)
salary is below 10,000 and whose lastname starts with
letter K.  Question 1
Correct
Which SQL statement give the required output
format of the salary?  Mark 1.00 out of 1.00

Select one:

a. SELECT last_name, TO_NUMBER(salary,


'$999,999.99') AS "MONTHLY SALARY" FROM
Flag question Flag question

Question text Question text

You want to display the employee id, date hired John want to know how many employees
of all employees whose hired date is September. receiving salary below 10,000. What SQL
command he need to run?
Which SQL statement give the required output?
Select one:

a. SELECT salary FROM


COUNT(employees)WHERE salary < 10000;

b. SELECT COUNT(salary) FROM employees


WHERE salary < 10,000;

Select one: c. SELECT COUNT(emp_id) FROM employees


WHERE salary <= 10000;
a. SELECT employee_id, hire_date,
TO_CHAR(hire_date, 'Month') AS "Hired Month" d. SELECT COUNT(*) FROM employees WHERE
FROM employees WHERE TO_CHAR(hire_date, salary < 10000; 
'Month') = TO_DATE('September')
Question 3
Correct
b. SELECT employee_id, hire_date,
TO_CHAR(hire_date, 'Month') AS "Hired Month" Mark 1.00 out of 1.00
FROM employees WHERE TO_CHAR(hire_date,
'MON') = 'SEP' 

c. SELECT employee_id, hire_date,


TO_CHAR(hire_date, 'Month') AS "Hired Month" Flag question
FROM employees WHERE TO_DATE(hire_date,
Question text
'Month') = TO_DATE(‘09’)
What will be the output of the following SQL? 
d. SELECT employee_id, hire_date,
TO_DATE(hire_date, 'Month') AS "Hired Month" SELECT * FROM parts WHERE (warehouse = 1 or
FROM employees WHERE TO_DATE(hire_date, warehouse = 2) AND class IN ('HW', 'AP') AND
'MON') = 'SEP' (price > 200 AND price < 500);
Select one:
Question 2
Correct
a. 7 rows returned
Mark 1.00 out of 1.00

b. Error
c. 0 rows returned What is the SQL command to display the date of
the first employee that was hired?
d. Invalid SQL command Select one:

e. 2 rows returned  a. SELECT MIN(hire_date) FROM employees; 


Question 4
Correct b. SELECT FIRST(hire_date) FROM employees;

Mark 1.00 out of 1.00


c. SELECT hire_date FROM employees WHERE
FIRST(hire_date );

d. SELECT hire_date FROM employees WHERE


TO_CHAR(hire_date) = ‘FIRST’;
Flag question
Question 6
Question text Correct

Mark 1.00 out of 1.00


Ms. Ella what to generate the average salary of all
employees whose job function is IT_PROG. 

Which of the following SQL command will


produce the output.
Select one: Flag question

Question text
a. SELECT AVG(salary) FROM employees WHERE
job_id = 'IT_PROG';  John want to know how many part items are
there in warehouse number 3.
b. SELECT AVE(salary) FROM employees WHERE
job_id = 'IT_PROG'; What SQL command he need to run?
Select one:
c. SELECT AVERAGE(salary) FROM employees
WHERE job_id = 'IT_PROG'; a. SELECT partnum FROM COUNT(parts)WHERE
warehouse = 3;
d. SELECT COUNT AVG(salary) FROM employees
WHERE job_id = 'IT_PROG'; b. SELECT * FROM COUNT(parts) WHERE
Question 5
warehouse = 3;
Correct
c. SELECT COUNT(*) FROM parts WHERE
Mark 1.00 out of 1.00
warehouse = 3; 

d. SELECT ALL FROM COUNT(parts) WHERE


warehouse = 3;

Flag question Question 7


Correct
Question text
Mark 1.00 out of 1.00
WHERE class = 'AP'
GROUP BY warehouse, class
ORDER BY warehouse; 

Flag question b. SELECT warehouse, class, MAX(price),


Question text MIN(PRICE), sum(onhand)
FROM parts
Aldrin wants to know the highest salary in every WHERE class = 'AP'
department. Which of the following SQL GROUP BY warehouse, class, price
command will display the required output? ORDER BY warehouse, class

Select one:
c. SELECT warehouse, class, HIGH(price),
LOW(PRICE), SUM(onhand)
a. SELECT department_id, HIGHEST(salary) FROM
FROM parts
employees GROUP BY salary;
GROUP BY warehouse
b. SELECT department_id, MAXIMUM(salary) WHERE class = 'AP'
FROM employees GROUP BY department_id; ORDER BY warehouse, class;

c. SELECT department_id, HIGH(salary) FROM d. SELECT warehouse, class, MAX(price),


employees GROUP BY department_id AND salary; MIN(PRICE), SUM(onhand)
FROM parts
d. SELECT department_id, MAX(salary) FROM GROUP BY warehouse, class
employees GROUP BY department_id  ORDER BY warehouse;
WHERE class = 'AP'
Question 8
Correct Question 9
Correct
Mark 1.00 out of 1.00
Mark 1.00 out of 1.00

Flag question
Flag question
Question text
Question text
Display the warehouse number, class, highest
price & lowest price, total on hand balance You want to display the employee id and the
whose class is AP. month an employee was hired.

Sort the output by warehouse number. Which SQL statement give the required output?
Select one: Required output :

a. SELECT warehouse, class, MAX(price),


MIN(PRICE), sum(onhand)
FROM parts
Select one: c. SELECT employee_id, hire_date,
MONTH(hire_date,'Month') AS "Hired Month", job_id 
a. SELECT employee_id, DATE(hire_date,'Month') FROM employees WHERE job_id EXCLUDE ('AD_VP');
AS 'Hired Month'FROM employees;
d. SELECT employee_id, hire_date,
b. SELECT employee_id, TO_CHAR(hire_date,'Month') AS "Hired Month",
TO_MONTH(hire_date,'Month') AS 'Hired job_id FROM employees WHERE job_id NOT IN
Month'FROM employees; ('AD_VP'); 

c. SELECT employee_id, hire_date, Question 11


Correct
TO_CHAR(hire_date,'Month') AS "Hired Month"
FROM employees;  Mark 1.00 out of 1.00

d. SELECT employee_id, hire_date,


MONTH(hire_date) AS "Hired Month" FROM
employees;
Flag question
Question 10
Correct
Question text
Mark 1.00 out of 1.00
You want to display the employee's last name
hired from year 2000 to 2002.

Which SQL statement give the required output?


Select one:
Flag question

Question text a. SELECT last_name, hire_date FROM employees


WHERE hire_date>= TO_DATE('01-Jan-2000',
You want to display all the employee id and the 'DD-Mon-YYYYY') AND hire_date<=
month an employee was hired excluding TO_DATE('31-Dec-2002', 'DD-Mon-YYYY')
employees whose job id is AD_VP. Which SQL
statement give the required output? b. SELECT last_name, hire_date FROM employees
WHERE hire_date>= TO_DATE('01-Jan-2000',
Select one:
'DD-Mon-RR') AND hire_date<= TO_DATE('31-
a. SELECT employee_id, hire_date, Dec-2002', 'DD-Mon-RR') 
TO_DATE(hire_date,'Month') AS "Hired Month",
c. SELECT last_name, hire_date FROM employees
job_id FROM employees WHERE job_id NOT =
WHERE hire_date>= TO_DATE('Jan-2000',
'AD_VP';
'Month-YYYY') AND hire_date<= TO_DATE('Dec-
b. SELECT employee_id, hire_date, 2002', 'Month-‘YYYY')
TO_MONTH(hire_date,'Month') AS "Hired
d. SELECT last_name, hire_date FROM employees
Month", job_id FROM employees WHERE job_id
WHERE hire_date>= TO_DATE('2000', 'YYYY')
NOT ('AD_VP');
AND hire_date<= TO_DATE('2002', 'YYYY')

Question 12
Correct
b. SELECT last_name, hire_date FROM employees
Mark 1.00 out of 1.00 WHERE hire_date >= TO_DATE('Jan-2000',
'Month-YYYY') AND hire_date <= TO_DATE('Dec-
2002', 'Month-‘YYYY') AND salary > 5,000;

c. SELECT last_name, hire_date FROM employees


Flag question WHERE hire_date >= TO_DATE('2000', 'YYYY')
Question text AND hire_date <= TO_DATE('2002', 'YYYY') OR
salary > 5000;
What will be the output of the SQL command?
SELECT SUM(onhand) FROM PARTS where class d. SELECT last_name, hire_date FROM employees
= 'HW' OR class = 'AP' AND warehouse = 1; WHERE hire_date >= TO_DATE('01-Jan-2002',
'DD-Mon-RR') AND hire_date <= TO_DATE('31-
Select one: Dec-2002', 'DD-Mon-RR') AND salary > 5000; 

a. 137  Question 14
Correct

b. 178 Mark 1.00 out of 1.00

c. 85

d. 44

Question 13 Flag question


Correct
Question text
Mark 1.00 out of 1.00

You want to display the employee's last name


whose salary is below 10,000. 

Which SQL statement give the required output


format of the salary?
Flag question
Required output :
Question text

You want to display the employee's last name


and date hired in year 2002 whose salary is above
5000.

Which SQL statement give the required output?


Select one:

a. SELECT last_name, hire_date FROM employees


WHERE hire_date >= TO_DATE('01-Jan-2000',
'DD-Mon-YYYYY') AND hire_date <=
TO_DATE('31-Dec-2002', 'DD-Mon-YYYY')AND
salary ABOVE 5000; Select one:
Question 16
a. SELECT last_name, TO_INT(salary,
Correct
'$999,999.99') AS "MONTHLY SALARY" FROM
Mark 1.00 out of 1.00
employees WHERE salary < 10,000

b. SELECT last_name, TO_INTEGER(salary,


$999,999.99) AS "MONTHLY SALARY" FROM
employees WHERE salary < 10000
Flag question
c. SELECT last_name, TO_CHAR(salary,
Question text
'$999,999.99') AS "MONTHLY SALARY" FROM
employees WHERE salary < 10000  The General Manager request to the Database
Administrator to generate the total salary per
d. SELECT last_name, TO_NUMBER(salary,
month of every department in the company.
'$999,999.99') AS "MONTHLY SALARY" FROM
employees WHERE salary < 10,000 Select one:

Question 15 a. SELECT department_id, SUM(salary) FROM


Incorrect
employees GROUP BY department_id 
Mark 0.00 out of 1.00
b. SELECT department_id, TOTAL(salary) FROM
employees GROUP BY department_id

c. SELECT department_id, salary FROM


Flag question employees GROUP BY SUM(salary) ORDER BY
department_id
Question text
d. SELECT department_id, salary FROM
Display a summary table of the total quantity on
employees ORDER BY SUM(salary)
hand above 50 very class per warehouse
Question 17
Select one: Correct

Mark 1.00 out of 1.00


a. SELECT warehouse, class, sum(onhand) FROM
parts WHERE SUM(ONHAND) > 50 

b. SELECT warehouse, class, sum(onhand) FROM


parts GROUP BY warehouse HAVING
SUM(ONHAND) > 50 Flag question

Question text
c. SELECT warehouse, class, sum(onhand) FROM
parts GROUP BY warehouse,class HAVING Which of the following SQL command will display
SUM(ONHAND) > 50 the summary table showing the total quantity on
hand per class.
d. SELECT warehouse, class, sum(onhand) FROM
parts GROUP BY warehouseWHERE Select one:
SUM(ONHAND) > 50
a. SELECT class, TOTAL(onhand) AS "QTY ON
HAND" FROM parts GROUP BY class, onhand

b. SELECT class, sum(onhand) AS "QTY ON


Flag question
HAND" FROM parts GROUP BY onhand
Question text
c. SELECT class, onhand AS "QTY ON HAND"
FROM parts GROUP BY sum(onhand) Aldrin wants to know the outstanding total
balance on hand on every class per warehouse.
d. SELECT class, sum(onhand) AS "QTY ON
Select one:
HAND" FROM parts GROUP BY class 

Question 18 a. SELECT warehouse, class, onhand FROM parts


Correct GROUP BY warehouse, class
Mark 1.00 out of 1.00
b. SELECT TOTAL(warehouse), TOTAL(class),
TOTAL(onhand) FROM parts GROUP BY
warehouse, class

c. SELECT warehouse, class, sum(onhand) FROM


Flag question
parts GROUP BY warehouse, class 
Question text
d. SELECT warehouse, class, onhand FROM parts
You want to display the employee id and the year GROUP BYsum(warehouse), sum(class);
when an employee was hired. 
Question 20
Which SQL statement give the required output? Correct

Select one: Mark 1.00 out of 1.00

a. SELECT employee_id, YEAR(hire_date') FROM


employees;

b. SELECT employee_id, YEAR(hire_date,'YYYY') Flag question


FROM employees;
Question text
c. SELECT employee_id,
You want to display the employee’s last name whose
TO_CHAR(hire_date,'YYYY') FROM employees;  salary is below 10,000 and whose lastname starts with
letter K. 
d. SELECT employee_id,
TO_YEAR(hire_date,'YYYY') FROM employees; Which SQL statement give the required output
format of the salary? 
Question 19
Correct Select one:

Mark 1.00 out of 1.00


a. SELECT last_name, TO_NUMBER(salary,
'$999,999.99') AS "MONTHLY SALARY" FROM
employees WHERE salary < 10,000WHERE Question text
last_name = ‘K%’
Create a SQL command to update the employees
b. SELECT last_name, TO_CHAR(salary, table
'$999,999.99') AS "MONTHLY SALARY" FROM
Employee id : 200 
employees WHERE salary < 10000WHERE
Name : Mr. Gary Park 
last_name LIKE ‘K%’ 
Date hired : July 1, 2017 
c. SELECT last_name, TO_INTEGER(salary,
Position :IT Programmer 
$999,999.99) AS "MONTHLY SALARY" FROM
employees WHERE salary < 10000 WHERE Salary : 10000 
last_name IN 'K%' Department of assignment : 60 
Reporting to manager : 103
d. SELECT last_name, TO_INT(salary,
'$999,999.99') AS "MONTHLY SALARY" FROM Select one:
employees WHERE salary < 10,000 WHERE
a. INSERT INTO employees
last_name STARTS 'K%'
(employee_id,first_name,last_name,hire_date,job_i
d,salary,manager_id,department_id)
BL-PROG-3114-LAB-1922S VALUES (200,'Gary','Park',TO_DATE('Jul 1, 2017',
'MON DD, YYYY'), 'IT_PROG', 10000, 103, 60)
PROGG(ORACLE DATABASE)
NCIIIP2 b. INSERT FROM employees
VALUES (200,'Gary','Park',TO_DATE('Jul 1, 2017',
 Dashboard 'MON DD, YYYY'), 'IT_PROG', 10000, 103, 60) 
 My courses
  BL-PROG-3114-LAB-1922S c. INSERT FROM employees
  Week 7: Manipulate Data VALUES (200,'Gary','Park', TO_CHAR('Jul 1, 2017',
  Learning Activity 2 'MON DD, YYYY'), 'IT_PROG', 10000, 103, 60)

Started on Thursday, 19 December 2019, 7:49 PM


d. INSERT INTO employees
State Finished (employee_id,first_name,last_name,hire_date,job_i
d,salary,manager_id,department_id)
Completed on Thursday, 19 December 2019, 7:51 PM
VALUES (200,'Gary','Park', TO_CHAR('Jul 1, 2017',
Time taken 1 min 44 secs 'MON DD, YYYY'), 'IT_PROG', 10000, 103, 60)
Grade 6.00 out of 10.00 (60%) Question 2
Correct
Question 1
Incorrect Mark 1.00 out of 1.00

Mark 0.00 out of 1.00

Flag question

Flag question Question text


Remove the Shareholder Services department in d. UPDATE employees SET salary = salary + 500
the department table where YEAR(sysdate,'YYYY') -
Select one: YEAR(hire_date,'YYYY') >= 10

Question 4
a. DELETE * FROM departments_name HAVING Correct
department_name LIKE '%Shareholder Services%'
Mark 1.00 out of 1.00

b. DELETE departments FROM


departments_name WHERE department_name =
‘%Shareholder Services%’

c. None of the choices Flag question

Question text
d. DELETE FROM departments WHERE
department_name = ‘Shareholder Services’  Given the SQL command
Question 3 SELECT employees.first_name,
Correct employees.last_name,
Mark 1.00 out of 1.00
employees.salary,departments.department_name
FROM employees, departments
WHERE employees.department_id =
departments.department_id;
Which of the following describes the SQL
Flag question
command?

Question text Select one:

Add a 500 pesos increase in salary of all a. List of employees name, salary and
employees who have rendered services 10 years department name 
and above.
b. Cartesian Product
Select one:
c. Results to invalid SQL command
a. UPDATE salary FROM employees SET salary +
500 where TO_YEAR(sysdate,'YYYY') - d. Results to invalid relational operator
TO_YEAR(hire_date,'YYYY') >= 10
e. Display a full outer join
b. UPDATE salary= salary + 500 where
Question 5
TO_DATE(sysdate,'YYYY') - Incorrect
TO_DATE(hire_date,'YYYY') >= 10
Mark 0.00 out of 1.00

c. UPDATE employees SET salary = salary + 500


where TO_CHAR(sysdate,'YYYY') -
TO_CHAR(hire_date,'YYYY') >= 10 

Flag question
Question text department ON (department_id) WHERE
department_name = 'Finance' 
Update the Purchasing department name to
Procurement. And this will be managed by the b. SELECT A.first_name, A.last_name, A.job_id,
Manager of Administration department. B.department_name FROM employees A JOIN
departments B ON ( A.department_id =
Select one:
B.department_id) WHERE B.department_name =
a. UPDATE FROM departments SET 'Finance'
department_name = 'Procurement' AND
c. SELECT A.first_name, A.last_name, A.job_id,
manager_id = 200 WHERE department_name =
B.department_name FROM employees A INNER
'Purchasing' 
JOIN departments B ON ( A.department_id =
b. UPDATE departments SET department_name = B.department_id) ON B.department_name =
'Procurement', manager_id = 200 WHERE 'Finance'
department_name = 'Purchasing'
d. All of the choices
c. UPDATE * FROM departments SET Question 7
department_name = 'Procurement', SET Correct
manager_id = 200 HAVING department_name =
Mark 1.00 out of 1.00
'Purchasing'

d. UPDATE departments_name FROM


departments SET department_name =
'Procurement', SET manager_id = 200 WHERE
Flag question
department_name = 'Purchasing'
Question text
Question 6
Incorrect
A new department name Training with
Mark 0.00 out of 1.00 department id 300 was created in the company.
This will be managed by a Manager with ID of
203 and will located at location id 2400. 

Create a SQL command to update the


information in the department table.
Flag question
Select one:
Question text
a. INSERT INTO departments SET department_id
Display all the employee id, names of
= 300, department_name = 'Training',
employees ,job id and department nameof all
manager_id = 203, location_id = 2400
employees of the Finance Department.

Select one: b. INSERT FROM departments(department_id,


department_name, manager_id, location_id)
a. SELECT first_name, last_name, job_id, VALUES (300, 'Training', 203, 2400)
department_name FROM employees JOIN
c. INSERT INTO departments VALUES (300, Create a SQL command to add a new position
'Training', 203, 2400)  Database Administrator with job id of DB_ADMIN
whose salary ranges from 10,000 to 18,000.
d. INSERT * FROM departments VALUES (300, Select one:
'Training', 203, 2400)
a. INSERT * FROM jobs VALUES ('DB_ADMIN',
Question 8
Correct 'Database Administrator', 10000, 18000)

Mark 1.00 out of 1.00


b. INSERT FROM jobs VALUES ('DB_ADMIN',
'Database Administrator', 10000, 18000)

c. INSERT FROM jobs SET job_id = 'DB_ADMIN',


job_title= 'Database Administrator', min_salary =
Flag question 10000, max_salary=18000
Question text
d. INSERT INTO jobs VALUES ('DB_ADMIN',
Create a SQL command to add a new position 'Database Administrator', 10000, 18000) 
Java Developer with job id of JAVA_DEV whose
Question 10
salary ranges from 7,000 to 8,000. Incorrect

Select one: Mark 0.00 out of 1.00

a. INSERT FROM jobs SET jobs_id = ‘JAVA_DEV’,


job_title = ‘Java Developer’ , min_salary =7000 ,
max_salary= 8000
Flag question
b. INSERT * INTO jobs VALUES (JAVA_DEV, Java
Developer, 7000, 8000) Question text

c. INSERT INTO jobs VALUES ('JAVA_DEV', 'Java Update the Treasury department to Cash
Developer', 7000, 8000)  department. And this will be managed by the
Manager of Finance department.
d. INSERT FROM jobs(jobs_id, job_title, Select one:
min_salary, max_salary) VALUES ('JAVA_DEV',
'Java Developer', 7000, 8000) a. UPDATE FROM departments SET
department_name = 'Procurement', SET
Question 9
Correct manager_id = 100 HAVING department_name =
'Treasury' 
Mark 1.00 out of 1.00

b. UPDATE department_name = 'Procurement',


manager_id = 100 FROM departmentsWHERE
department_name = 'Treasury'

Flag question

Question text
c. UPDATE department_name = 'Procurement' a. INSERT FROM jobs SET jobs_id = ‘JAVA_DEV’,
AND manager_id = 100FROM departments job_title = ‘Java Developer’ , min_salary =7000 ,
WHERE department_name = 'Treasury' max_salary= 8000

d. UPDATE departments SET department_name = b. INSERT * INTO jobs VALUES (JAVA_DEV, Java
'Procurement', manager_id = 100 WHERE Developer, 7000, 8000)
department_name = 'Treasury'
c. INSERT INTO jobs VALUES ('JAVA_DEV', 'Java
Developer', 7000, 8000) 
BL-PROG-3114-LAB-1922S
PROGG(ORACLE DATABASE) d. INSERT FROM jobs(jobs_id, job_title,
min_salary, max_salary) VALUES ('JAVA_DEV',
NCIIIP2
'Java Developer', 7000, 8000)

Question 2
 Dashboard Correct
 My courses
  BL-PROG-3114-LAB-1922S Mark 1.00 out of 1.00
  Week 7: Manipulate Data
  Learning Activity 2

Started on Thursday, 19 December 2019, 7:54 PM

State Finished Flag question

Completed on Question text


Thursday, 19 December 2019, 7:55 PM

Time taken 1 min 16 secs


A new department name Training with
Grade 9.00 out of 10.00 (90%) department id 300 was created in the company.
This will be managed by a Manager with ID of
Question 1
Correct
203 and will located at location id 2400. 

Mark 1.00 out of 1.00 Create a SQL command to update the


information in the department table.
Select one:

a. INSERT * FROM departments VALUES (300,


Flag question 'Training', 203, 2400)

Question text
b. INSERT INTO departments SET department_id
= 300, department_name = 'Training',
Create a SQL command to add a new position
manager_id = 203, location_id = 2400
Java Developer with job id of JAVA_DEV whose
salary ranges from 7,000 to 8,000.
c. INSERT FROM departments(department_id,
Select one: department_name, manager_id, location_id)
VALUES (300, 'Training', 203, 2400)
d. INSERT INTO departments VALUES (300, Given the SQL command
'Training', 203, 2400)  SELECT employees.first_name,
employees.last_name,
Question 3 employees.salary,departments.department_name
Correct
FROM employees, departments
Mark 1.00 out of 1.00 WHERE employees.department_id =
departments.department_id;
Which of the following describes the SQL
command?

Select one:
Flag question

Question text a. Results to invalid relational operator

Display the manager id and employee id of every b. Cartesian Product


employee
c. Results to invalid SQL command
Select one:
d. Display a full outer join
a. SELECT E.employee_id, D.manager_id FROM
employees E FULL JOIN departments D WHERE e. List of employees name, salary and
E.department_id = D.department_id department name 

b. SELECT E.employee_id, D.manager_id FROM Question 5


Correct
employees E INNER JOIN departments D USING
E.department_id = D.department_id Mark 1.00 out of 1.00

c. SELECT E.employee_id, D.manager_id FROM


employees E OUTER JOIN departments D ON
E.department_id = D.department_id
Flag question
d. SELECT E.employee_id, D.manager_id FROM
employees E JOIN departments D ON Question text
E.department_id = D.department_id 
Remove all Manager positions in the department
Question 4 table.
Correct
Select one:
Mark 1.00 out of 1.00

a. DELETE * FROM jobs WHERE job_title =


‘%Manager%’;

b. DELETE job_title FROM jobs WHERE


Flag question IN(job_title) = ‘%Manager%’;
Question text
c. DELETE jobs FROM jobs_id = ‘*MGR*’
d. DELETE FROM jobs WHERE job_title LIKE Diana Lorentz was transferred to Administration
'%Manager%';  department. Using the employees and
department table information update the profile
Question 6 of employee.
Correct
Select one:
Mark 1.00 out of 1.00

a. UPDATE FROM employees SET manager_id =


200, department_id = 10 WHERE last_name =
'Lorentz' AND first_name = 'Diana'; 

Flag question b. UPDATE employees SET manager_id = 200,


Question text department_id = 10 WHERE last_name = 'Lorentz'
AND first_name = 'Diana';
Add a 500 pesos increase in salary of all
employees who have rendered services 10 years c. UPDATE FROM employees SET manager_id =
and above. 200, SET department_id = 10 WHERE last_name =
'Lorentz' AND first_name = 'Diana';
Select one:
d. UPDATE employees SET manager_id = 200,
a. UPDATE employees SET salary = salary + 500
SET department_id = 10 WHERE last_name =
where TO_CHAR(sysdate,'YYYY') -
'Lorentz' AND first_name = 'Diana';
TO_CHAR(hire_date,'YYYY') >= 10 
Question 8
b. UPDATE salary FROM employees SET salary + Correct

500 where TO_YEAR(sysdate,'YYYY') - Mark 1.00 out of 1.00


TO_YEAR(hire_date,'YYYY') >= 10

c. UPDATE salary= salary + 500 where


TO_DATE(sysdate,'YYYY') -
TO_DATE(hire_date,'YYYY') >= 10
Flag question

d. UPDATE employees SET salary = salary + 500 Question text


where YEAR(sysdate,'YYYY') -
YEAR(hire_date,'YYYY') >= 10 Remove the Shareholder Services department in
the department table
Question 7
Incorrect Select one:

Mark 0.00 out of 1.00


a. DELETE * FROM departments_name HAVING
department_name LIKE '%Shareholder Services%'

b. DELETE FROM departments WHERE


department_name = ‘Shareholder Services’ 
Flag question

Question text
Mark 1.00 out of 1.00
c. DELETE departments FROM
departments_name WHERE department_name =
‘%Shareholder Services%’

d. None of the choices


Flag question
Question 9
Correct Question text

Mark 1.00 out of 1.00


Given the SQL command
SELECT * FROM employees JOIN departments
USING (department_id)
Which of the following describes the SQL
command?
Flag question
Select one:
Question text
a. Results to invalid relational operator
Display the location id of all employee's name
and salary whose salary is from 5000 to 10000. b. Joined table from the employees and
Select one: department table 

a. SELECT employees.first_name, c. Results to invalid SQL command


employees.last_name, employees.salary FROM
d. Cartesian Product
employees JOIN departments ON
(department_id) WHERE employees.salary >=
e. Display a full outer join
5000 AND employees.salary <= 10000

b. SELECT first_name, last_name, salary FROM


employees JOIN departments USING
(department_id) WHERE MIN(salary) = 5000 AND
MAX(salary) = 10000

c. SELECT employees.first_name,
employees.last_name, employees.salary FROM
employees CROSS JOIN departments USING
(department_id) WHERE employees.salary >=
5000 AND employees.salary <= 10000

d. SELECT first_name, last_name, salary FROM


employees JOIN departments USING
(department_id) WHERE salary >= 5000 AND
salary <= 10000 

Question 10
Correct

You might also like