0% found this document useful (0 votes)
3K views

BL Prog 3114. 2019 2020.

SELECT employee_id, hire_date, ROUND((SYSDATE - hire_date) /365,0) FROM employees; This SQL statement displays the employee ID, hire date, and number of years worked for each employee by calculating the difference between the current date and hire date in years.

Uploaded by

JM pajenago
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3K views

BL Prog 3114. 2019 2020.

SELECT employee_id, hire_date, ROUND((SYSDATE - hire_date) /365,0) FROM employees; This SQL statement displays the employee ID, hire date, and number of years worked for each employee by calculating the difference between the current date and hire date in years.

Uploaded by

JM pajenago
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 166

BL-PROG-

3114-LAB-
1922S
SY:2019-2020
YELLOW – CORRECT
GREEN – CORRECT
RED – INCORRECT
By: Rose Del Concepcion
Which of the following is the correct report that will display the CLASS from table PARTS.
Select one:
c. SELECT CLASS FROM PARTS;

Create an SQL command to display the name of the parts, warehouse number, price and the
available stock on hand whose price is below 500. Arrange the list by warehouse number and
by class.
Select one:
a. SELECT partnum, description, warehouse, onhand, price FROM parts WHERE price <
500 ORDER BY warehouse, class;

Display all employees whose job id contains the word 'ACCOUNT'.


Select one:
b. SELECT * FROM EMPLOYEES WHERE job_id LIKE '%ACCOUNT%';

Which of the following SQL command will display all records with class code of AP?
Select one:
a. SELECT * FROM parts WHERE class = ‘AP’;

Display employee's name and id whose firstname starts with letter D and job id is SA_REP.
Sort the output by department.
Select one:
a. SELECT employee_id, first_name, last_name FROM employees WHERE first_name
LIKE 'D%' and job_id = 'IT_PROG' ORDER BY department_id

Which of the following SELECT statement is the correctreport that will combine the column
PARTNUM and DESCRIPTION put a literal character string "belongs to" in between the two
columns then rename the column as "NUMBER TITLE". Note put space before and after the
character literal string to avoid no spaces in the report.
b. SELECT (PARTNUM||' THAT BELONGS TO '||DESCRIPTION) AS "NUMBER
TITLE" FROM PARTS;

SQL stands for


Select one:
b. Structured Query Language

Which of the following SELECT statement is the correct report that will deduct 5 from
ONHAND, multiply 5 in WAREHOUSE, after getting the value on both ONHAND and
WAREHOUSE add their data: as shown below: ONHAND - 5 + 5 * WAREHOUSE
Note that you have to force the Oracle to prioritize first the Subtraction over Multiplication. List
only the column DESCRIPTION, ONHAND and WAREHOUSE.
b. SELECT (ONHAND-5) + 5 * WAREHOUSE, DESCRIPTION FROM PARTS;

Using Data Manipulation Language, you can ADD columns in the table.
Select one:
False

Which of the following SELECT statement is the correctreport the will merge the column
CLASS and PRICE rename the COLUMN as "CLASS PRICE".
c. SELECT (CLASS||PRICE) AS "CLASS PRICE" FROM PARTS;

Display the employee id, number of years and the hiring date of every employee in the
company.
b. SELECT employee_id, hire_date, ROUND((SYSDATE - hire_date) /365,0) FROM
employees;

1. The two development environments of Oracle are _______________ and ______________.

c. Oracle SQL Developer; SQL command line

Which of the following is an Oracle Proprietary Commands


Select one:
b. SQL *Plus

Display the first 5 letter in the surname of all the employees whose firstname starts with letter
'D'
c. SELECT SUBSTR(last_name,1,5), first_name FROM employees WHERE
SUBSTR(first_name,1,1) = 'D'

Using CREATE SQL Command, you can add new records in the table.
False

Which of the following is a Data Definition Language?


b. DROP

Display the first 3 letter in the first name of all the employees.
c. SELECT SUBSTR(first_name,1,3) FROM employees;

Display the part number whose class is not HW, AG or SG.


b. SELECT partnum FROM parts WHERE class NOT IN ('HW', 'AG', SG')

You can relate data to multiple tables using a foreign key.


True

Which of the following SELECT statement is the correct PL/SQL that will display all rows and
columns?
d. SELECT * FROM PARTS;

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 order.
b. SELECT first_name, last_name, salary FROM employees WHERE department_id = 100
AND salary < 8000 ORDER BY salary
Every employee will get a bonus of 150% of his/her current salary. Display the employee id,
salary and the bonus of every employee. Label the computed bonus with Bonus
b. SELECT employee_id, salary, salary * 1.5 AS Bonus FROM employees

Each row of data in a table can be uniquely identified by a


Select one:
a. primary key

Command use to display table structure


c. DESCRIBE
Display all the employee's id and salary whose annual salary is from 100,000 to 200,000.
Arrange the output by salary in descending order.
b. SELECT employee_id, salary FROM employees WHERE salary *12 >= 100000 AND
salary *12 <= 200000 ORDER BY salary desc

Which of the following SQL commands will display all stocks whose class is HW or AP.
d. SELECT * FROM parts WHERE IN class ('HW', 'AP');

Display the last day of the month and the hiring date when the employees are hired in the
company.
b. SELECT LAST_DAY(hire_date), hire_date FROM employees;

Display all the records whose stock is below 20 and in warehouse number 3.
d. SELECT * FROM parts WHERE onhand< 20 AND warehouse = 3;

Display all employees id and remainder of the his/her salary after it is divided by 3,000 for all
employees with the job id of IT_PROG.
b. SELECT employee_id, job_id, salary, MOD(salary, 3000) FROM employees WHERE
job_id = 'IT_PROG'

Create a SQL script to display the fullname of evey employee with the format Lastname,
Firstname example Santos, Arnold. Display the output in a single column. Label the column as
Fullname
c. SELECT CONCAT(CONCAT(last_name, ','), first_name) AS Fullname FROM
employees;

Started on Wednesday, 1 January 2020, 3:45 PM


State Finished
Completed on Wednesday, 1 January 2020, 3:59 PM
Time taken 14 mins 36 secs
Grade 8.00 out of 10.00 (80%)

Question 1

Display the montly salary of every employee. Round the salary in 2 decimal places.
e. SELECT ROUND( (salary/12),2 ) FROM employees;

Question 2
Display the employee id and the last name of every employee in the company whose salary is
between 5000 to 10000. Display the output in a single column with the format 100 : King Label
the column as Employee
c. SELECT CONCAT(CONCAT(employee_id, ':'), last_name) AS Employee FROM
employees WHERE salary >= 5000 AND salary <= 10000

Which of the following SQL commands will display all the stocks on hand from 10 to 30?
e. SELECT * FROM parts WHERE onhand BETWEEN 10 AND 30;

ANSI SQL commands cannot be abbreviated.


True
Which of the following SELECT statement is the correct report that will rename the column
DESCRIPTION to TITLE, PARTNUM to ID and ONHAND to STOCK?
c. SELECT DESCRIPTION AS 'TITLE', PARTNUM AS 'ID', ONHAND AS 'STOCK'
FROM PARTS;

Display the total number of characters of the last name of all the employees.
a. SELECT LENGTH(last_name) FROM employees;

Display all the records sorted by price from most expensive to the cheapest parts.
g. SELECT * FROM parts ORDER BY price DESC

Display part number description and warehouse number whose part number starts with letter K.
c. SELECT partnum, description, warehouse FROM parts WHERE partnum LIKE 'K%';

Which of the following SELECT statement is the correct PL/SQL that will display eliminate the
duplicate rows for column class and warehouse.
d. SELECT DISTINCT CLASS, WAREHOUSE FROM PARTS;

Which of the following is NOT a Data Manipulation Language?


e. CREATE

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 DESCRIPTION, CLASS and PRICE.
Select one:
a. SELECT PRICE*0.10, DESCRIPTION, CLASS FROM PARTS;
b. SELECT PRICE*10, DESCRIPTION, CLASS FROM PARTS;
c. SELECT PRICE*10+PRICE, DESCRIPTION, CLASS FROM PARTS;
d. SELECT PRICE*0.10 FROM PARTS;

Ronnie is the stockman in the warehouse of ATR Corporation. The General Manager wants to
know the parts whose price is above 10000 and above. Which of the following SQL command
that Ronnie will run to generate the list.
f. SELECT * FROM parts WHERE price >= 10000;

Which of the following SELECT statement is the correct report that will display the unique
value for WAREHOUSE renames the column as "No. of Available Warehouse".
Select one:
d. SELECT DISTINCT WAREHOUSE AS "No. of available warehouse" FROM PARTS;

Command use to display table structure


c. DESCRIBE

Which of the following SELECT statement is the correct report that will deduct 5 from
ONHAND, multiply 5 in WAREHOUSE, after getting the value on both ONHAND and
WAREHOUSE add their data: as shown below: ONHAND - 5 + 5 * WAREHOUSE
Note that you have to force the Oracle to prioritize first the Subtraction over Multiplication. List
only the column DESCRIPTION, ONHAND and WAREHOUSE.
a. SELECT (ONHAND-5) + 5 * WAREHOUSE, DESCRIPTION FROM PARTS;

The following are capabilities of SQL SELECT


a. Projection, Selection, Join records

Display all the records sorted by price from most expensive to the cheapest parts.
a. SELECT * FROM parts ORDER BY price DESC

List all the employee_id of all employees whose salary is 5000 and below and belong to
department 60 or 100.
c. SELECT employee_id,salary, department_id FROM employees WHERE salary < 5000
AND department_id IN (60,100)

Which of the following SELECT statement is the correct PL/SQL that willcreate a report
specifying only the column PRICE, ONHAND and DESCRIPTION?
c. SELECT PRICE, ONHAND, DESCRIPTION FROM PARTS;

ANSI SQL commands cannot be abbreviated.


Select one:
True

Display part number description and warehouse number whose part number starts with letter K.
c. SELECT partnum, description, warehouse FROM parts WHERE partnum LIKE 'K%';

Display the employee id and the last name of every employee in the company whose salary is
between 5000 to 10000. Display the output in a single column with the format 100 : King Label
the column as Employee
c. SELECT CONCAT(CONCAT(employee_id, ':'), last_name) AS Employee FROM
employees WHERE salary >= 5000 AND salary <= 10000

Which of the following SQL command will display all records with class code of AP?
Select one:
a. SELECT * FROM parts WHERE class = ‘AP’;

Which of the following SELECT statement is the correct PL/SQL that willcreate a report
specifying only the column PRICE, ONHAND and DESCRIPTION?
c. SELECT PRICE, ONHAND, DESCRIPTION FROM PARTS;
Which of the following SELECT statement is the correct report that will rename the column
DESCRIPTION to TITLE, PARTNUM to ID and ONHAND to STOCK?
c. SELECT DESCRIPTION AS 'TITLE', PARTNUM AS 'ID', ONHAND AS 'STOCK'
FROM PARTS;

Which of the following SELECT statement is the correct PL/SQL that will display eliminate the
duplicate rows for column class and warehouse.
Select one:
a. SELECT DISTINCT CLASS, WAREHOUSE FROM PARTS;
b. SELECT DISTINCT CLASS AND DISTINCT WAREHOUSE FROM PARTS;
c. SELECT DISTINCT CLASS, DISTINCT WAREHOUSE FROM PARTS;
d. SELECT DISTINCT CLASS AND WAREHOUSE FROM PARTS;

Question 7

Create an SQL command to display the name of the parts, warehouse number, price and the
available stock on hand whose price is below 500. Arrange the list by warehouse number and
by class.
Select one:
a. SELECT partnum, description, warehouse, onhand, price FROM parts ORDER BY
warehouse, class WHERE price < 500;
b. SELECT partnum, description, warehouse, onhand, price FROM parts WHERE price <
500 ORDER BY warehouse, class;
c. SELECT partnum, description, warehouse, onhand, price WHERE price < 500 ORDER
BY warehouse, class FROM parts
d. SELECT partnum, description, warehouse, onhand, price FROM parts ORDER BY
warehouse, class WHERE 500 < price;
e. SELECT partnum, description, warehouse, onhand, price ORDER BY warehouse, class
ORDER BY warehouse, class FROM parts WHERE price < 500

Question 8

Display the part number whose class is not HW, AG or SG.


Select one:
a. SELECT partnum FROM parts WHERE class NOT IN ('HW', 'AG', SG')
b. SELECT partnum FROM parts WHERE NOT IN class ('HW', 'AG', SG')
c. SELECT partnum FROM parts WHERE class NOT IN = (‘HW’, AG’, SG’)
d. None of the choices

Question 9

Create a SQL script to display the fullname of evey employee with the format Lastname,
Firstname example Santos, Arnold. Display the output in a single column. Label the column as
Fullname
Select one:
a. SELECT CONCAT(last_name, first_name) FROM employees
b. SELECT CONCAT(last_name, ',', first_name) AS Fullname FROM employees
c. SELECT CONCAT(last_name, first_name) AS Fullname FROM employees;
d. SELECT CONCAT(CONCAT(last_name, ','), first_name) AS Fullname FROM
employees;

Question 10

Which of the following SELECT statement is the correctreport that will combine the column
PARTNUM and DESCRIPTION put a literal character string "belongs to" in between the two
columns then rename the column as "NUMBER TITLE". Note put space before and after the
character literal string to avoid no spaces in the report.
Select one:
a. SELECT (PARTNUM||' THAT BELONGS TO '||DESCRIPTION) AS "NUMBER
TITLE" FROM PARTS;
b. SELECT (PARTNUM||' THAT BELONGS TO '||DESCRIPTION) AS NUMBER TITLE
FROM PARTS;
c. SELECT (PARTNUM|| THAT BELONGS TO ||DESCRIPTION) AS "NUMBER
TITLE" FROM PARTS;
d. SELECT (;PARTNUM'||' THAT BELONGS TO '||'DESCRIPTION;) AS "NUMBER
TITLE" FROM PARTS;

Started on Thursday, 12 December 2019, 3:37 PM


State Finished
Completed on Thursday, 12 December 2019, 3:42 PM
Time taken 4 mins 51 secs
Grade 9.00 out of 10.00 (90%)

Question 1

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.
Select one:
a. INSERT INTO jobs VALUES ('JAVA_DEV', 'Java Developer', 7000, 8000)
b. INSERT FROM jobs SET jobs_id = ‘JAVA_DEV’, job_title = ‘Java Developer’ ,
min_salary =7000 , max_salary= 8000
c. INSERT FROM jobs(jobs_id, job_title, min_salary, max_salary) VALUES
('JAVA_DEV', 'Java Developer', 7000, 8000)
d. INSERT * INTO jobs VALUES (JAVA_DEV, Java Developer, 7000, 8000)

Question 2

A new department name Training with 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.

Select one:
a. INSERT * FROM departments VALUES (300, 'Training', 203, 2400)
b. INSERT INTO departments SET department_id = 300, department_name = 'Training',
manager_id = 203, location_id = 2400
c. INSERT FROM departments(department_id, department_name, manager_id, location_id)
VALUES (300, 'Training', 203, 2400)
d. INSERT INTO departments VALUES (300, 'Training', 203, 2400)

Question 3

Display the location id of all employee's name and salary whose salary is from 5000 to 10000.
Select one:
a. SELECT first_name, last_name, salary FROM employees JOIN departments USING
(department_id) WHERE salary >= 5000 AND 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 employees.first_name, employees.last_name, employees.salary FROM
employees JOIN departments ON (department_id) WHERE employees.salary >= 5000 AND
employees.salary <= 10000

Question 4

Diana Lorentz was transferred to Administration department. Using the employees and
department table information update the profile of employee.
Select one:
a. UPDATE employees SET manager_id = 200, department_id = 10 WHERE last_name =
'Lorentz' AND first_name = 'Diana';
b. UPDATE employees SET manager_id = 200, SET department_id = 10 WHERE
last_name = 'Lorentz' AND first_name = 'Diana';
c. UPDATE FROM employees SET manager_id = 200, department_id = 10 WHERE
last_name = 'Lorentz' AND first_name = 'Diana';
d. UPDATE FROM employees SET manager_id = 200, SET department_id = 10 WHERE
last_name = 'Lorentz' AND first_name = 'Diana';

Question 5

Remove all Manager positions in the department table.


Select one:
a. DELETE job_title FROM jobs WHERE IN(job_title) = ‘%Manager%’;
b. DELETE jobs FROM jobs_id = ‘*MGR*’
c. DELETE * FROM jobs WHERE job_title = ‘%Manager%’;
d. DELETE FROM jobs WHERE job_title LIKE '%Manager%';

Question 6

Update the Purchasing department name to Procurement. And this will be managed by the
Manager of Administration department.
Select one:
a. UPDATE departments SET department_name = 'Procurement', manager_id = 200
WHERE department_name = 'Purchasing'
b. UPDATE departments_name FROM departments SET department_name =
'Procurement', SET manager_id = 200 WHERE department_name = 'Purchasing'
c. UPDATE FROM departments SET department_name = 'Procurement' AND manager_id
= 200 WHERE department_name = 'Purchasing'
d. UPDATE * FROM departments SET department_name = 'Procurement', SET
manager_id = 200 HAVING department_name = 'Purchasing'

Question 7

Update the Treasury department to Cash department. And this will be managed by the Manager
of Finance department.
Select one:
a. UPDATE FROM departments SET department_name = 'Procurement', SET manager_id
= 100 HAVING department_name = 'Treasury'
b. UPDATE department_name = 'Procurement' AND manager_id = 100FROM departments
WHERE department_name = 'Treasury'
c. UPDATE department_name = 'Procurement', manager_id = 100 FROM
departmentsWHERE department_name = 'Treasury'
d. UPDATE departments SET department_name = 'Procurement', manager_id = 100
WHERE department_name = 'Treasury'

Question 8

Add a 500 pesos increase in salary of all employees who have rendered services 10 years and
above.
Select one:
a. UPDATE salary FROM employees SET salary + 500 where TO_YEAR(sysdate,'YYYY')
- TO_YEAR(hire_date,'YYYY') >= 10
b. UPDATE salary= salary + 500 where TO_DATE(sysdate,'YYYY') -
TO_DATE(hire_date,'YYYY') >= 10
c. UPDATE employees SET salary = salary + 500 where TO_CHAR(sysdate,'YYYY') -
TO_CHAR(hire_date,'YYYY') >= 10
d. UPDATE employees SET salary = salary + 500 where YEAR(sysdate,'YYYY') -
YEAR(hire_date,'YYYY') >= 10

Question 9

Create a SQL command to add a new position Database Administrator with job id of
DB_ADMIN whose salary ranges from 10,000 to 18,000.
Select one:
a. INSERT FROM jobs VALUES ('DB_ADMIN', 'Database Administrator', 10000, 18000)
b. INSERT FROM jobs SET job_id = 'DB_ADMIN', job_title= 'Database Administrator',
min_salary = 10000, max_salary=18000
c. INSERT INTO jobs VALUES ('DB_ADMIN', 'Database Administrator', 10000, 18000)
d. INSERT * FROM jobs VALUES ('DB_ADMIN', 'Database Administrator', 10000,
18000)

Question 10
Display all the employee id, names of employees ,job id and department nameof all employees
of the Finance Department.
Select one:
a. SELECT A.first_name, A.last_name, A.job_id, B.department_name FROM employees A
JOIN departments B ON ( A.department_id = B.department_id) WHERE B.department_name =
'Finance'
b. SELECT A.first_name, A.last_name, A.job_id, B.department_name FROM employees A
INNER JOIN departments B ON ( A.department_id = B.department_id) ON
B.department_name = 'Finance'
c. SELECT first_name, last_name, job_id, department_name FROM employees JOIN
department ON (department_id) WHERE department_name = 'Finance'
d. All of the choices
Started on Wednesday, 1 January 2020, 4:28 PM
State Finished
Completed on Wednesday, 1 January 2020, 4:41 PM
Time taken 12 mins 35 secs
Grade 10.00 out of 10.00 (100%)

Question 1

Remove the Shareholder Services department in the department table


Select one:
a. DELETE * FROM departments_name HAVING department_name LIKE '%Shareholder
Services%'
b. None of the choices
c. DELETE departments FROM departments_name WHERE department_name =
‘%Shareholder Services%’
d. DELETE FROM departments WHERE department_name = ‘Shareholder Services’

Question 2

Create a SQL command to add a new position Database Administrator with job id of
DB_ADMIN whose salary ranges from 10,000 to 18,000.
Select one:
a. INSERT FROM jobs SET job_id = 'DB_ADMIN', job_title= 'Database Administrator',
min_salary = 10000, max_salary=18000
b. INSERT INTO jobs VALUES ('DB_ADMIN', 'Database Administrator', 10000, 18000)
c. INSERT * FROM jobs VALUES ('DB_ADMIN', 'Database Administrator', 10000,
18000)
d. INSERT FROM jobs VALUES ('DB_ADMIN', 'Database Administrator', 10000, 18000)

Question 3

Given the SQL command


SELECT employees.first_name, employees.last_name,
employees.salary,departments.department_name
FROM employees, departments
WHERE employees.department_id = departments.department_id;
Which of the following describes the SQL command?
Select one:
a. List of employees name, salary and department name
b. Display a full outer join
c. Results to invalid relational operator
d. Cartesian Product
e. Results to invalid SQL command

Question 4

Update the Treasury department to Cash department. And this will be managed by the Manager
of Finance department.
Select one:
a. UPDATE department_name = 'Procurement', manager_id = 100 FROM
departmentsWHERE department_name = 'Treasury'
b. UPDATE departments SET department_name = 'Procurement', manager_id = 100
WHERE department_name = 'Treasury'
c. UPDATE department_name = 'Procurement' AND manager_id = 100FROM departments
WHERE department_name = 'Treasury'
d. UPDATE FROM departments SET department_name = 'Procurement', SET manager_id
= 100 HAVING department_name = 'Treasury'

Question 5

Given the SQL command


SELECT * FROM employees JOIN departments USING (department_id)
Which of the following describes the SQL command?
Select one:
a. Display a full outer join
b. Joined table from the employees and department table
c. Results to invalid SQL command
d. Results to invalid relational operator
e. Cartesian Product

Question 6

Display the location id of all employee's name and salary whose salary is from 5000 to 10000.
Select one:
a. SELECT employees.first_name, employees.last_name, employees.salary FROM
employees JOIN departments ON (department_id) WHERE employees.salary >= 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 7

Display the manager id and employee id of every employee


Select one:
a. SELECT E.employee_id, D.manager_id FROM employees E JOIN departments D ON
E.department_id = D.department_id
b. SELECT E.employee_id, D.manager_id FROM employees E FULL JOIN departments D
WHERE E.department_id = D.department_id
c. SELECT E.employee_id, D.manager_id FROM employees E OUTER JOIN departments
D ON E.department_id = D.department_id
d. SELECT E.employee_id, D.manager_id FROM employees E INNER JOIN departments
D USING E.department_id = D.department_id

Question 8

Remove all Manager positions in the department table.


Select one:
a. DELETE * FROM jobs WHERE job_title = ‘%Manager%’;
b. DELETE jobs FROM jobs_id = ‘*MGR*’
c. DELETE job_title FROM jobs WHERE IN(job_title) = ‘%Manager%’;
d. DELETE FROM jobs WHERE job_title LIKE '%Manager%';

Question 9

Create a SQL command to update the employees table

Employee id : 200

Name : Mr. Gary Park

Date hired : July 1, 2017

Position :IT Programmer

Salary : 10000

Department of assignment : 60

Reporting to manager : 103

Select one:
a. INSERT FROM employees
VALUES (200,'Gary','Park', TO_CHAR('Jul 1, 2017', 'MON DD, YYYY'), 'IT_PROG', 10000,
103, 60)
b. INSERT FROM employees
VALUES (200,'Gary','Park',TO_DATE('Jul 1, 2017', 'MON DD, YYYY'), 'IT_PROG', 10000,
103, 60)
c. INSERT INTO employees
(employee_id,first_name,last_name,hire_date,job_id,salary,manager_id,department_id)
VALUES (200,'Gary','Park', TO_CHAR('Jul 1, 2017', 'MON DD, YYYY'), 'IT_PROG', 10000,
103, 60)
d. INSERT INTO employees
(employee_id,first_name,last_name,hire_date,job_id,salary,manager_id,department_id)
VALUES (200,'Gary','Park',TO_DATE('Jul 1, 2017', 'MON DD, YYYY'), 'IT_PROG', 10000,
103, 60)

Question 10

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.
Select one:
a. INSERT * INTO jobs VALUES (JAVA_DEV, Java Developer, 7000, 8000)
b. INSERT FROM jobs(jobs_id, job_title, min_salary, max_salary) VALUES
('JAVA_DEV', 'Java Developer', 7000, 8000)
c. INSERT FROM jobs SET jobs_id = ‘JAVA_DEV’, job_title = ‘Java Developer’ ,
min_salary =7000 , max_salary= 8000
d. INSERT INTO jobs VALUES ('JAVA_DEV', 'Java Developer', 7000, 8000)

Started on Wednesday, 18 December 2019, 10:31 AM


State Finished
Completed on Wednesday, 18 December 2019, 10:45 AM
Time taken 13 mins 48 secs
Grade 16.00 out of 20.00 (80%)

Question 1

Display a summary table of the total quantity on hand above 50 very class per warehouse
Select one:
a. SELECT warehouse, class, sum(onhand) FROM parts GROUP BY warehouse HAVING
SUM(ONHAND) > 50
b. SELECT warehouse, class, sum(onhand) FROM parts WHERE SUM(ONHAND) > 50
c. SELECT warehouse, class, sum(onhand) FROM parts GROUP BY warehouseWHERE
SUM(ONHAND) > 50
d. SELECT warehouse, class, sum(onhand) FROM parts GROUP BY warehouse,class
HAVING SUM(ONHAND) > 50

Question 2

You want to display all the employee id and the month an employee was hired excluding
employees whose job id is AD_VP. Which SQL statement give the required output?
Select one:
a. SELECT employee_id, hire_date, TO_DATE(hire_date,'Month') AS "Hired Month",
job_id FROM employees WHERE job_id NOT = 'AD_VP';
b. SELECT employee_id, hire_date, TO_MONTH(hire_date,'Month') AS "Hired Month",
job_id FROM employees WHERE job_id NOT ('AD_VP');
c. SELECT employee_id, hire_date, TO_CHAR(hire_date,'Month') AS "Hired Month",
job_id FROM employees WHERE job_id NOT IN ('AD_VP');
d. SELECT employee_id, hire_date, MONTH(hire_date,'Month') AS "Hired Month",
job_id FROM employees WHERE job_id EXCLUDE ('AD_VP');
Question 3

The General Manager request to the Database Administrator to generate the total salary per
month of every department in the company.
Select one:
a. SELECT department_id, salary FROM employees ORDER BY SUM(salary)
b. SELECT department_id, TOTAL(salary) FROM employees GROUP BY department_id
c. SELECT department_id, salary FROM employees GROUP BY SUM(salary) ORDER
BY department_id
d. SELECT department_id, SUM(salary) FROM employees GROUP BY department_id

Question 4

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

Question 5

Aldrin wants to know the highest salary in every department. Which of the following SQL
command will display the required output?
Select one:
a. SELECT department_id, MAX(salary) FROM employees GROUP BY department_id
b. SELECT department_id, MAXIMUM(salary) FROM employees GROUP BY
department_id;
c. SELECT department_id, HIGH(salary) FROM employees GROUP BY department_id
AND salary;
d. SELECT department_id, HIGHEST(salary) FROM employees GROUP BY salary;

Question 6

John want to know how many employees receiving salary below 10,000. What SQL command
he need to run?
Select one:
a. SELECT COUNT(salary) FROM employees WHERE salary < 10,000;
b. SELECT COUNT(*) FROM employees WHERE salary < 10000;
c. SELECT salary FROM COUNT(employees)WHERE salary < 10000;
d. SELECT COUNT(emp_id) FROM employees WHERE salary <= 10000;

Question 7

You want to display the employee id and the year when an employee was hired.

Which SQL statement give the required output?


Select one:
a. SELECT employee_id, YEAR(hire_date') FROM employees;
b. SELECT employee_id, TO_CHAR(hire_date,'YYYY') FROM employees;
c. SELECT employee_id, TO_YEAR(hire_date,'YYYY') FROM employees;
d. SELECT employee_id, YEAR(hire_date,'YYYY') FROM employees;

Question 8

What will be the output of the SQL command?


SELECT SUM(onhand) FROM PARTS where class = 'HW' OR class = 'AP' AND warehouse =
1;
Select one:
a. 85
b. 44
c. 178
d. 137

Question 9

You want to display the employee's id and formatted date hired as shown below.

Which SQL statement give the required output?

Required output :

Select one:
a. SELECT employee_id, TO_CHAR(hire_date, 'Month DD, YYYY') AS "Hired Date"
FROM employees;
b. SELECT employee_id, format(TO_DATE(hire_date, 'Month DD, YYYY')) AS "Hired
Date" FROM employees;
c. SELECT employee_id, TO_DATE (hire_date, 'format Month DD, YYYY') AS "Hired
Date" FROM employees;
d. SELECT employee_id, TO_CHAR(hire_date, 'fmMonth DD, YYYY') AS "Hired Date"
FROM employees;

Question 10

Display the warehouse number, class, highest price & lowest price, total on hand balance whose
class is AP.

Sort the output by warehouse number.


Select one:
a. SELECT warehouse, class, MAX(price), MIN(PRICE), sum(onhand)
FROM parts
WHERE class = 'AP'
GROUP BY warehouse, class
ORDER BY warehouse;
b. SELECT warehouse, class, MAX(price), MIN(PRICE), sum(onhand)
FROM parts
WHERE class = 'AP'
GROUP BY warehouse, class, price
ORDER BY warehouse, class
c. SELECT warehouse, class, MAX(price), MIN(PRICE), SUM(onhand)
FROM parts
GROUP BY warehouse, class
ORDER BY warehouse;
WHERE class = 'AP'
d. SELECT warehouse, class, HIGH(price), LOW(PRICE), SUM(onhand)
FROM parts
GROUP BY warehouse
WHERE class = 'AP'
ORDER BY warehouse, class;

Question 11

You want to display the employee's last name hired from year 2000 to 2002.

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')
b. SELECT last_name, hire_date FROM employees WHERE hire_date>= TO_DATE('01-
Jan-2000', '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('Jan-
2000', 'Month-YYYY') AND hire_date<= TO_DATE('Dec-2002', 'Month-‘YYYY')
d. SELECT last_name, hire_date FROM employees WHERE hire_date>=
TO_DATE('2000', 'YYYY') AND hire_date<= TO_DATE('2002', 'YYYY')

Question 12

There was 10% price increase in the all the parts in warehouse number 3. The Store Manager
asked the Database Administrator to generate a report showing the part number, the old and
new price.

Which of the following SQL statement would satisfy the requirement of the Store Manager.

Select one:
a. SELECT partnum, price, price * 0.1 FROM parts WHERE warehouse = 3
b. SELECT partnum, price, price * 10% FROM parts WHERE warehouse = 3
c. SELECT partnum, price, price * 1.1 FROM parts
WHERE warehouse = 3
d. SELECT partnum, price, price * 1.10% FROM parts WHERE warehouse = 3

Question 13

John want to know how many part items are there in warehouse number 3.

What SQL command he need to run?

Select one:
a. SELECT ALL FROM COUNT(parts) WHERE warehouse = 3;
b. SELECT * FROM COUNT(parts) WHERE warehouse = 3;
c. SELECT COUNT(*) FROM parts WHERE warehouse = 3;
d. SELECT partnum FROM COUNT(parts)WHERE warehouse = 3;

Question 14

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?

Required output :

Select one:
a. SELECT last_name, TO_INT(salary, '$999,999.99') AS "MONTHLY SALARY" FROM
employees WHERE salary < 10,000
b. SELECT last_name, TO_CHAR(salary, '$999,999.99') AS "MONTHLY SALARY"
FROM employees WHERE salary < 10000
c. SELECT last_name, TO_NUMBER(salary, '$999,999.99') AS "MONTHLY SALARY"
FROM employees WHERE salary < 10,000
d. SELECT last_name, TO_INTEGER(salary, $999,999.99) AS "MONTHLY SALARY"
FROM employees WHERE salary < 10000

Question 15

You want to display the employee id and the month an employee was hired.

Which SQL statement give the required output?

Required output :
Select one:
a. SELECT employee_id, hire_date, MONTH(hire_date) AS "Hired Month" FROM
employees;
b. SELECT employee_id, hire_date, TO_CHAR(hire_date,'Month') AS "Hired Month"
FROM employees;
c. SELECT employee_id, DATE(hire_date,'Month') AS 'Hired Month'FROM employees;
d. SELECT employee_id, TO_MONTH(hire_date,'Month') AS 'Hired Month'FROM
employees;

Question 16

Which of the following SQL command will display all records with part number contains the
number 9?
Select one:
a. SELECT partnum FROM parts WHERE partnum = ‘%9%’
b. SELECT partnum FROM parts WHERE partnum BETWEEN = ‘%9%’
c. SELECT * from parts WHERE partnum LIKE '%9%'
d. SELECT * FROM parts WHERE partnum IN ('%9%')

Question 17

You want to display the employee id, date hired of all employees whose hired date is
September.

Which SQL statement give the required output?

Select one:
a. SELECT employee_id, hire_date, TO_CHAR(hire_date, 'Month') AS "Hired Month"
FROM employees WHERE TO_CHAR(hire_date, 'MON') = 'SEP'
b. SELECT employee_id, hire_date, TO_CHAR(hire_date, 'Month') AS "Hired Month"
FROM employees WHERE TO_DATE(hire_date, 'Month') = TO_DATE(‘09’)
c. SELECT employee_id, hire_date, TO_DATE(hire_date, 'Month') AS "Hired Month"
FROM employees WHERE TO_DATE(hire_date, 'MON') = 'SEP'
d. SELECT employee_id, hire_date, TO_CHAR(hire_date, 'Month') AS "Hired Month"
FROM employees WHERE TO_CHAR(hire_date, 'Month') = TO_DATE('September')

Question 18

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.

Select one:
a. SELECT warehouse, class, count(partnum), sum(onhand) GROUP BY warehouse,class
HAVING warehouse = 1 or warehouse = 2 FROM parts;
b. SELECT warehouse, class, count(partnum), sum(onhand) GROUP BY warehouse,class
WHERE warehouse = 1 or warehouse = 2 FROM parts;
c. SELECT warehouse, class, SUM(partnum), SUM(onhand) FROM parts GROUP BY
warehouse,class HAVING warehouse = 1 AND warehouse = 2;
d. SELECT warehouse, class, COUNT(partnum), SUM(onhand) FROM parts GROUP BY
warehouse,class HAVING warehouse = 1 OR warehouse = 2;

Question 19

You want to display the last name and the year when an employee was hired whose job id is
IT_PROG.

Which SQL statement give the required output?

Select one:
a. SELECT last_name, YEAR(hire_date,'YYYY') FROM employees WHERE job_id =
‘IT_PROG’;
b. SELECT last_name, TO_CHAR(hire_date,'YYYY') FROM employees WHERE job_id =
‘IT_PROG’;
c. SELECT last_name, TO_YEAR(hire_date,'YYYY') FROM employees WHERE job_id =
‘IT_PROG’;
d. SELECT last_name, YEAR(hire_date') FROM employees WHERE job_id = ‘IT_PROG’;

Question 20

What is the SQL command to display the date of the first employee that was hired?
Select one:
a. SELECT hire_date FROM employees WHERE TO_CHAR(hire_date) = ‘FIRST’;
b. SELECT FIRST(hire_date) FROM employees;
c. SELECT MIN(hire_date) FROM employees;
d. SELECT hire_date FROM employees WHERE FIRST(hire_date );

Started on Tuesday, 31 December 2019, 1:27 PM


State Finished
Completed on Tuesday, 31 December 2019, 1:44 PM
Time taken 16 mins 57 secs
Grade 19.00 out of 20.00 (95%)

Question 1

You want to display the last name and the year when an employee was hired whose job id is
IT_PROG.

Which SQL statement give the required output?

Select one:
a. SELECT last_name, TO_CHAR(hire_date,'YYYY') FROM employees WHERE job_id =
‘IT_PROG’;
b. SELECT last_name, YEAR(hire_date') FROM employees WHERE job_id = ‘IT_PROG’;
c. SELECT last_name, YEAR(hire_date,'YYYY') FROM employees WHERE job_id =
‘IT_PROG’;
d. SELECT last_name, TO_YEAR(hire_date,'YYYY') FROM employees WHERE job_id =
‘IT_PROG’;

Question 2

Correct
You want to display the employee’s last name whose salary is below 10,000 and whose
lastname starts with letter K.

Which SQL statement give the required output format of the salary?

Select one:
a. SELECT last_name, TO_INTEGER(salary, $999,999.99) AS "MONTHLY SALARY"
FROM employees WHERE salary < 10000 WHERE last_name IN 'K%'
b. SELECT last_name, TO_CHAR(salary, '$999,999.99') AS "MONTHLY SALARY"
FROM employees WHERE salary < 10000WHERE last_name LIKE ‘K%’
c. SELECT last_name, TO_NUMBER(salary, '$999,999.99') AS "MONTHLY SALARY"
FROM employees WHERE salary < 10,000WHERE last_name = ‘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%'

Question 3

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-2002', 'DD-Mon-RR') AND hire_date <= TO_DATE('31-Dec-2002', 'DD-Mon-RR') AND
salary > 5000;
b. 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;
c. SELECT last_name, hire_date FROM employees WHERE hire_date >= TO_DATE('Jan-
2000', 'Month-YYYY') AND hire_date <= TO_DATE('Dec-2002', 'Month-‘YYYY') AND
salary > 5,000;
d. SELECT last_name, hire_date FROM employees WHERE hire_date >=
TO_DATE('2000', 'YYYY') AND hire_date <= TO_DATE('2002', 'YYYY') OR salary > 5000;

Question 4

The General Manager request to the Database Administrator to generate the total salary per
month of every department in the company.
Select one:
a. SELECT department_id, TOTAL(salary) FROM employees GROUP BY department_id
b. SELECT department_id, salary FROM employees ORDER BY SUM(salary)
c. SELECT department_id, SUM(salary) FROM employees GROUP BY department_id
d. SELECT department_id, salary FROM employees GROUP BY SUM(salary) ORDER
BY department_id

Question 5

Correct
Mark 1.00 out of 1.00
Which of the following SQL command will display all records with part number contains the
number 9?
Select one:
a. SELECT * FROM parts WHERE partnum IN ('%9%')
b. SELECT partnum FROM parts WHERE partnum = ‘%9%’
c. SELECT * from parts WHERE partnum LIKE '%9%'
d. SELECT partnum FROM parts WHERE partnum BETWEEN = ‘%9%’

Question 6

Aldrin wants to know the outstanding total balance on hand on every class per warehouse.
Select one:
a. SELECT warehouse, class, sum(onhand) FROM parts GROUP BY warehouse, class
b. SELECT warehouse, class, onhand FROM parts GROUP BYsum(warehouse),
sum(class);
c. SELECT TOTAL(warehouse), TOTAL(class), TOTAL(onhand) FROM parts GROUP
BY warehouse, class
d. SELECT warehouse, class, onhand FROM parts GROUP BY warehouse, class

Question 7

You want to display all the employee id and the month an employee was hired excluding
employees whose job id is AD_VP. Which SQL statement give the required output?
Select one:
a. SELECT employee_id, hire_date, TO_DATE(hire_date,'Month') AS "Hired Month",
job_id FROM employees WHERE job_id NOT = 'AD_VP';
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');
c. SELECT employee_id, hire_date, TO_MONTH(hire_date,'Month') AS "Hired Month",
job_id FROM employees WHERE job_id NOT ('AD_VP');
d. SELECT employee_id, hire_date, MONTH(hire_date,'Month') AS "Hired Month",
job_id FROM employees WHERE job_id EXCLUDE ('AD_VP');

Question 8

You want to display the employee id and the month an employee was hired.

Which SQL statement give the required output?


Required output :

Select one:
a. SELECT employee_id, TO_MONTH(hire_date,'Month') AS 'Hired Month'FROM
employees;
b. SELECT employee_id, hire_date, TO_CHAR(hire_date,'Month') AS "Hired Month"
FROM employees;
c. SELECT employee_id, hire_date, MONTH(hire_date) AS "Hired Month" FROM
employees;
d. SELECT employee_id, DATE(hire_date,'Month') AS 'Hired Month'FROM employees;

Question 9

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?

Required output :

Select one:
a. SELECT last_name, TO_NUMBER(salary, '$999,999.99') AS "MONTHLY SALARY"
FROM employees WHERE salary < 10,000
b. SELECT last_name, TO_INT(salary, '$999,999.99') AS "MONTHLY SALARY" FROM
employees WHERE salary < 10,000
c. SELECT last_name, TO_CHAR(salary, '$999,999.99') AS "MONTHLY SALARY"
FROM employees WHERE salary < 10000
d. SELECT last_name, TO_INTEGER(salary, $999,999.99) AS "MONTHLY SALARY"
FROM employees WHERE salary < 10000

Question 10

You want to display the employee's id and formatted date hired as shown below.

Which SQL statement give the required output?

Required output :
Select one:
a. SELECT employee_id, TO_CHAR(hire_date, 'fmMonth DD, YYYY') AS "Hired Date"
FROM employees;
b. SELECT employee_id, TO_DATE (hire_date, 'format Month DD, YYYY') AS "Hired
Date" FROM employees;
c. SELECT employee_id, format(TO_DATE(hire_date, 'Month DD, YYYY')) AS "Hired
Date" FROM employees;
d. SELECT employee_id, TO_CHAR(hire_date, 'Month DD, YYYY') AS "Hired Date"
FROM employees;

Question 11

Aldrin wants to know the highest salary in every department. Which of the following SQL
command will display the required output?
Select one:
a. SELECT department_id, HIGHEST(salary) FROM employees GROUP BY salary;
b. SELECT department_id, HIGH(salary) FROM employees GROUP BY department_id
AND salary;
c. SELECT department_id, MAX(salary) FROM employees GROUP BY department_id
d. SELECT department_id, MAXIMUM(salary) FROM employees GROUP BY
department_id;

Question 12

You want to display the employee id, date hired of all employees whose hired date is September
.

Which SQL statement give the required output?

Select one:
a. SELECT employee_id, hire_date, TO_CHAR(hire_date, 'Month') AS "Hired Month"
FROM employees WHERE TO_CHAR(hire_date, 'MON') = 'SEP'
b. SELECT employee_id, hire_date, TO_CHAR(hire_date, 'Month') AS "Hired Month"
FROM employees WHERE TO_CHAR(hire_date, 'Month') = TO_DATE('September')
c. SELECT employee_id, hire_date, TO_DATE(hire_date, 'Month') AS "Hired Month"
FROM employees WHERE TO_DATE(hire_date, 'MON') = 'SEP'
d. SELECT employee_id, hire_date, TO_CHAR(hire_date, 'Month') AS "Hired Month"
FROM employees WHERE TO_DATE(hire_date, 'Month') = TO_DATE(‘09’)

Question 13

Display the warehouse number, class, highest price & lowest price, total on hand balance whose
class is AP.

Sort the output by warehouse number.

Select one:
a. SELECT warehouse, class, MAX(price), MIN(PRICE), sum(onhand)
FROM parts
WHERE class = 'AP'
GROUP BY warehouse, class
ORDER BY warehouse;
b. SELECT warehouse, class, HIGH(price), LOW(PRICE), SUM(onhand)
FROM parts
GROUP BY warehouse
WHERE class = 'AP'
ORDER BY warehouse, class;
c. SELECT warehouse, class, MAX(price), MIN(PRICE), sum(onhand)
FROM parts
WHERE class = 'AP'
GROUP BY warehouse, class, price
ORDER BY warehouse, class
d. SELECT warehouse, class, MAX(price), MIN(PRICE), SUM(onhand)
FROM parts
GROUP BY warehouse, class
ORDER BY warehouse;
WHERE class = 'AP'

Question 14

You want to display the employee id and the year when an employee was hired.

Which SQL statement give the required output?

Select one:
a. SELECT employee_id, YEAR(hire_date') FROM employees;
b. SELECT employee_id, TO_CHAR(hire_date,'YYYY') FROM employees;
c. SELECT employee_id, TO_YEAR(hire_date,'YYYY') FROM employees;
d. SELECT employee_id, YEAR(hire_date,'YYYY') FROM employees;

Question 15

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:
a. SELECT AVE(salary) FROM employees WHERE job_id = 'IT_PROG';
b. SELECT AVERAGE(salary) FROM employees WHERE job_id = 'IT_PROG';
c. SELECT AVG(salary) FROM employees WHERE job_id = 'IT_PROG';
d. SELECT COUNT AVG(salary) FROM employees WHERE job_id = 'IT_PROG';

Question 16

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.

Select one:
a. SELECT warehouse, class, count(partnum), sum(onhand) GROUP BY warehouse,class
WHERE warehouse = 1 or warehouse = 2 FROM parts;
b. SELECT warehouse, class, COUNT(partnum), SUM(onhand) FROM parts GROUP BY
warehouse,class HAVING warehouse = 1 OR warehouse = 2;
c. SELECT warehouse, class, SUM(partnum), SUM(onhand) FROM parts GROUP BY
warehouse,class HAVING warehouse = 1 AND warehouse = 2;
d. SELECT warehouse, class, count(partnum), sum(onhand) GROUP BY warehouse,class
HAVING warehouse = 1 or warehouse = 2 FROM parts;

Question 17

Display a summary table of the total quantity on hand above 50 very class per warehouse
Select one:
a. SELECT warehouse, class, sum(onhand) FROM parts GROUP BY warehouse HAVING
SUM(ONHAND) > 50
b. SELECT warehouse, class, sum(onhand) FROM parts GROUP BY warehouseWHERE
SUM(ONHAND) > 50
c. SELECT warehouse, class, sum(onhand) FROM parts GROUP BY warehouse,class
HAVING SUM(ONHAND) > 50
d. SELECT warehouse, class, sum(onhand) FROM parts WHERE SUM(ONHAND) > 50

Question 18

John want to know how many part items are there in warehouse number 3.

What SQL command he need to run?

Select one:
a. SELECT partnum FROM COUNT(parts)WHERE warehouse = 3;
b. SELECT * FROM COUNT(parts) WHERE warehouse = 3;
c. SELECT COUNT(*) FROM parts WHERE warehouse = 3;
d. SELECT ALL FROM COUNT(parts) WHERE warehouse = 3;

Question 19

What will be the output of the following SQL?


SELECT * FROM parts WHERE (warehouse = 1 or warehouse = 2) AND class IN ('HW', 'AP')
AND (price > 200 AND price < 500);

Select one:
a. Invalid SQL command
b. 0 rows returned
c. 7 rows returned
d. Error
e. 2 rows returned

Question 20

John want to know how many employees receiving salary below 10,000. What SQL command
he need to run?
Select one:
a. SELECT COUNT(emp_id) FROM employees WHERE salary <= 10000;
b. SELECT COUNT(salary) FROM employees WHERE salary < 10,000;
c. SELECT salary FROM COUNT(employees)WHERE salary < 10000;
d. SELECT COUNT(*) FROM employees WHERE salary < 10000;

Started on Tuesday, 31 December 2019, 1:46 PM


State Finished
Completed on Tuesday, 31 December 2019, 1:55 PM
Time taken 9 mins 32 secs
Grade 19.00 out of 20.00 (95%)

Question 1

You want to display the employee's id and formatted date hired as shown below.

Which SQL statement give the required output?

Required output :

Select one:
a. SELECT employee_id, TO_CHAR(hire_date, 'fmMonth DD, YYYY') AS "Hired Date"
FROM employees;
b. SELECT employee_id, TO_CHAR(hire_date, 'Month DD, YYYY') AS "Hired Date"
FROM employees;
c. SELECT employee_id, format(TO_DATE(hire_date, 'Month DD, YYYY')) AS "Hired
Date" FROM employees;
d. SELECT employee_id, TO_DATE (hire_date, 'format Month DD, YYYY') AS "Hired
Date" FROM employees;

Question 2

What will be the output of the SQL command?


SELECT SUM(onhand) FROM PARTS where class = 'HW' OR class = 'AP' AND warehouse =
1;
Select one:
a. 44
b. 85
c. 178
d. 137

Question 3

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?

Required output :

Select one:
a. SELECT last_name, TO_INT(salary, '$999,999.99') AS "MONTHLY SALARY" FROM
employees WHERE salary < 10,000
b. SELECT last_name, TO_NUMBER(salary, '$999,999.99') AS "MONTHLY SALARY"
FROM employees WHERE salary < 10,000
c. SELECT last_name, TO_INTEGER(salary, $999,999.99) AS "MONTHLY SALARY"
FROM employees WHERE salary < 10000
d. SELECT last_name, TO_CHAR(salary, '$999,999.99') AS "MONTHLY SALARY"
FROM employees WHERE salary < 10000

Question 4

What is the SQL command to display the date of the first employee that was hired?
Select one:
a. SELECT hire_date FROM employees WHERE FIRST(hire_date );
b. SELECT MIN(hire_date) FROM employees;
c. SELECT hire_date FROM employees WHERE TO_CHAR(hire_date) = ‘FIRST’;
d. SELECT FIRST(hire_date) FROM employees;

Question 5

John want to know how many employees receiving salary below 10,000. What SQL command
he need to run?
Select one:
a. SELECT COUNT(salary) FROM employees WHERE salary < 10,000;
b. SELECT COUNT(emp_id) FROM employees WHERE salary <= 10000;
c. SELECT salary FROM COUNT(employees)WHERE salary < 10000;
d. SELECT COUNT(*) FROM employees WHERE salary < 10000;

Question 6

There was 10% price increase in the all the parts in warehouse number 3. The Store Manager
asked the Database Administrator to generate a report showing the part number, the old and
new price.

Which of the following SQL statement would satisfy the requirement of the Store Manager.

Select one:
a. SELECT partnum, price, price * 1.10% FROM parts WHERE warehouse = 3
b. SELECT partnum, price, price * 0.1 FROM parts WHERE warehouse = 3
c. SELECT partnum, price, price * 1.1 FROM parts WHERE warehouse = 3
d. SELECT partnum, price, price * 10% FROM parts WHERE warehouse = 3

Question 7

You want to display the last name and the year when an employee was hired whose job id is
IT_PROG.

Which SQL statement give the required output?

Select one:
a. SELECT last_name, YEAR(hire_date') FROM employees WHERE job_id = ‘IT_PROG’;
b. SELECT last_name, TO_YEAR(hire_date,'YYYY') FROM employees WHERE job_id =
‘IT_PROG’;
c. SELECT last_name, YEAR(hire_date,'YYYY') FROM employees WHERE job_id =
‘IT_PROG’;
d. SELECT last_name, TO_CHAR(hire_date,'YYYY') FROM employees WHERE job_id =
‘IT_PROG’;

Question 8

Aldrin wants to know the highest salary in every department. Which of the following SQL
command will display the required output?
Select one:
a. SELECT department_id, MAX(salary) FROM employees GROUP BY department_id
b. SELECT department_id, HIGHEST(salary) FROM employees GROUP BY salary;
c. SELECT department_id, HIGH(salary) FROM employees GROUP BY department_id
AND salary;
d. SELECT department_id, MAXIMUM(salary) FROM employees GROUP BY
department_id;

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

Select one:
a. SELECT warehouse, class, SUM(partnum), SUM(onhand) FROM parts GROUP BY
warehouse,class HAVING warehouse = 1 AND warehouse = 2;
b. SELECT warehouse, class, count(partnum), sum(onhand) GROUP BY warehouse,class
WHERE warehouse = 1 or warehouse = 2 FROM parts;
c. SELECT warehouse, class, count(partnum), sum(onhand) GROUP BY warehouse,class
HAVING warehouse = 1 or warehouse = 2 FROM parts;
d. SELECT warehouse, class, COUNT(partnum), SUM(onhand) FROM parts GROUP BY
warehouse,class HAVING warehouse = 1 OR warehouse = 2;

Question 10

What will be the output of the following SQL?

SELECT * FROM parts WHERE (warehouse = 1 or warehouse = 2) AND class IN ('HW', 'AP')
AND (price > 200 AND price < 500);

Select one:
a. 0 rows returned
b. Error
c. Invalid SQL command
d. 2 rows returned
e. 7 rows returned

Question 11

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:
a. SELECT AVG(salary) FROM employees WHERE job_id = 'IT_PROG';
b. SELECT AVERAGE(salary) FROM employees WHERE job_id = 'IT_PROG';
c. SELECT COUNT AVG(salary) FROM employees WHERE job_id = 'IT_PROG';
d. SELECT AVE(salary) FROM employees WHERE job_id = 'IT_PROG';

Question 12

John want to know how many part items are there in warehouse number 3.

What SQL command he need to run?

Select one:
a. SELECT partnum FROM COUNT(parts)WHERE warehouse = 3;
b. SELECT * FROM COUNT(parts) WHERE warehouse = 3;
c. SELECT ALL FROM COUNT(parts) WHERE warehouse = 3;
d. SELECT COUNT(*) FROM parts WHERE warehouse = 3;

Question 13

Aldrin wants to know the outstanding total balance on hand on every class per warehouse.
Select one:
a. SELECT warehouse, class, onhand FROM parts GROUP BY warehouse, class
b. SELECT warehouse, class, onhand FROM parts GROUP BYsum(warehouse),
sum(class);
c. SELECT warehouse, class, sum(onhand) FROM parts GROUP BY warehouse, class
d. SELECT TOTAL(warehouse), TOTAL(class), TOTAL(onhand) FROM parts GROUP
BY warehouse, class

Question 14

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;
b. SELECT last_name, hire_date FROM employees WHERE hire_date >=
TO_DATE('2000', 'YYYY') AND hire_date <= TO_DATE('2002', 'YYYY') OR salary > 5000;
c. SELECT last_name, hire_date FROM employees WHERE hire_date >= TO_DATE('Jan-
2000', 'Month-YYYY') AND hire_date <= TO_DATE('Dec-2002', 'Month-‘YYYY') AND
salary > 5,000;
d. SELECT last_name, hire_date FROM employees WHERE hire_date >= TO_DATE('01-
Jan-2002', 'DD-Mon-RR') AND hire_date <= TO_DATE('31-Dec-2002', 'DD-Mon-RR') AND
salary > 5000;

Question 15

Display a summary table of the total quantity on hand above 50 very class per warehouse
Select one:
a. SELECT warehouse, class, sum(onhand) FROM parts GROUP BY warehouse HAVING
SUM(ONHAND) > 50
b. SELECT warehouse, class, sum(onhand) FROM parts WHERE SUM(ONHAND) > 50
c. SELECT warehouse, class, sum(onhand) FROM parts GROUP BY warehouse,class
HAVING SUM(ONHAND) > 50
d. SELECT warehouse, class, sum(onhand) FROM parts GROUP BY warehouseWHERE
SUM(ONHAND) > 50

Question 16

You want to display the employee's last name hired from year 2000 to 2002.
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-RR') AND hire_date<= TO_DATE('31-Dec-2002', 'DD-Mon-RR')
b. SELECT last_name, hire_date FROM employees WHERE hire_date>=
TO_DATE('2000', 'YYYY') AND hire_date<= TO_DATE('2002', 'YYYY')
c. 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')
d. SELECT last_name, hire_date FROM employees WHERE hire_date>= TO_DATE('Jan-
2000', 'Month-YYYY') AND hire_date<= TO_DATE('Dec-2002', 'Month-‘YYYY')

Question 17

Correct
You want to display the employee’s last name whose salary is below 10,000 and whose
lastname starts with letter K.

Which SQL statement give the required output format of the salary?

Select one:
a. SELECT last_name, TO_NUMBER(salary, '$999,999.99') AS "MONTHLY SALARY"
FROM employees WHERE salary < 10,000WHERE last_name = ‘K%’
b. SELECT last_name, TO_INTEGER(salary, $999,999.99) AS "MONTHLY SALARY"
FROM employees WHERE salary < 10000 WHERE last_name IN 'K%'
c. SELECT last_name, TO_CHAR(salary, '$999,999.99') AS "MONTHLY SALARY"
FROM employees WHERE salary < 10000WHERE last_name LIKE ‘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%'

Question 18

You want to display the employee id and the year when an employee was hired.

Which SQL statement give the required output?

Select one:
a. SELECT employee_id, YEAR(hire_date') FROM employees;
b. SELECT employee_id, TO_CHAR(hire_date,'YYYY') FROM employees;
c. SELECT employee_id, TO_YEAR(hire_date,'YYYY') FROM employees;
d. SELECT employee_id, YEAR(hire_date,'YYYY') FROM employees;

Question 19

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

Question 20

The General Manager request to the Database Administrator to generate the total salary per
month of every department in the company.
Select one:
a. SELECT department_id, salary FROM employees GROUP BY SUM(salary) ORDER
BY department_id
b. SELECT department_id, TOTAL(salary) FROM employees GROUP BY department_id
c. SELECT department_id, salary FROM employees ORDER BY SUM(salary)
d. SELECT department_id, SUM(salary) FROM employees GROUP BY department_id

Started on Wednesday, 1 January 2020, 6:02 PM


State Finished
Completed on Wednesday, 1 January 2020, 6:15 PM
Time taken 12 mins 17 secs
Grade 19.00 out of 20.00 (95%)

Question 1

Aldrin wants to know the highest salary in every department. Which of the following SQL
command will display the required output?
Select one:
a. SELECT department_id, HIGH(salary) FROM employees GROUP BY department_id
AND salary;
b. SELECT department_id, MAXIMUM(salary) FROM employees GROUP BY
department_id;
c. SELECT department_id, MAX(salary) FROM employees GROUP BY department_id
d. SELECT department_id, HIGHEST(salary) FROM employees GROUP BY salary;

Question 2

John want to know how many employees receiving salary below 10,000. What SQL command
he need to run?
Select one:
a. SELECT COUNT(*) FROM employees WHERE salary < 10000;
b. SELECT COUNT(emp_id) FROM employees WHERE salary <= 10000;
c. SELECT COUNT(salary) FROM employees WHERE salary < 10,000;
d. SELECT salary FROM COUNT(employees)WHERE salary < 10000;

Question 3

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

Question 4

What will be the output of the SQL command?


SELECT SUM(onhand) FROM PARTS where class = 'HW' OR class = 'AP' AND warehouse =
1;
Select one:
a. 44
b. 178
c. 85
d. 137

Question 5

What will be the output of the following SQL?

SELECT * FROM parts WHERE (warehouse = 1 or warehouse = 2) AND class IN ('HW', 'AP')
AND (price > 200 AND price < 500);

Select one:
a. Invalid SQL command
b. Error
c. 0 rows returned
d. 7 rows returned
e. 2 rows returned

Question 6

Display a summary table of the total quantity on hand above 50 very class per warehouse
Select one:
a. SELECT warehouse, class, sum(onhand) FROM parts GROUP BY warehouse,class
HAVING SUM(ONHAND) > 50
b. SELECT warehouse, class, sum(onhand) FROM parts WHERE SUM(ONHAND) > 50
c. SELECT warehouse, class, sum(onhand) FROM parts GROUP BY warehouseWHERE
SUM(ONHAND) > 50
d. SELECT warehouse, class, sum(onhand) FROM parts GROUP BY warehouse HAVING
SUM(ONHAND) > 50

Question 7

Which of the following SQL command will display all records with part number contains the
number 9?
Select one:
a. SELECT partnum FROM parts WHERE partnum = ‘%9%’
b. SELECT * from parts WHERE partnum LIKE '%9%'
c. SELECT * FROM parts WHERE partnum IN ('%9%')
d. SELECT partnum FROM parts WHERE partnum BETWEEN = ‘%9%’

Question 8

You want to display the employee’s last name whose salary is below 10,000 and whose
lastname starts with letter K.

Which SQL statement give the required output format of the salary?

Select one:
a. SELECT last_name, TO_INT(salary, '$999,999.99') AS "MONTHLY SALARY" FROM
employees WHERE salary < 10,000 WHERE last_name STARTS 'K%'
b. SELECT last_name, TO_INTEGER(salary, $999,999.99) AS "MONTHLY SALARY"
FROM employees WHERE salary < 10000 WHERE last_name IN 'K%'
c. SELECT last_name, TO_CHAR(salary, '$999,999.99') AS "MONTHLY SALARY"
FROM employees WHERE salary < 10000WHERE last_name LIKE ‘K%’
d. SELECT last_name, TO_NUMBER(salary, '$999,999.99') AS "MONTHLY SALARY"
FROM employees WHERE salary < 10,000WHERE last_name = ‘K%’

Question 9

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:
a. SELECT AVERAGE(salary) FROM employees WHERE job_id = 'IT_PROG';
b. SELECT AVE(salary) FROM employees WHERE job_id = 'IT_PROG';
c. SELECT AVG(salary) FROM employees WHERE job_id = 'IT_PROG';
d. SELECT COUNT AVG(salary) FROM employees WHERE job_id = 'IT_PROG';

Question 10

You want to display the employee id, date hired of all employees whose hired date is
September.

Which SQL statement give the required output?

Select one:
a. SELECT employee_id, hire_date, TO_CHAR(hire_date, 'Month') AS "Hired Month"
FROM employees WHERE TO_CHAR(hire_date, 'Month') = TO_DATE('September')
b. SELECT employee_id, hire_date, TO_DATE(hire_date, 'Month') AS "Hired Month"
FROM employees WHERE TO_DATE(hire_date, 'MON') = 'SEP'
c. SELECT employee_id, hire_date, TO_CHAR(hire_date, 'Month') AS "Hired Month"
FROM employees WHERE TO_CHAR(hire_date, 'MON') = 'SEP'
d. SELECT employee_id, hire_date, TO_CHAR(hire_date, 'Month') AS "Hired Month"
FROM employees WHERE TO_DATE(hire_date, 'Month') = TO_DATE(‘09’)

Question 11

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('2000', 'YYYY') AND hire_date <= TO_DATE('2002', 'YYYY') OR salary > 5000;
b. 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;
c. SELECT last_name, hire_date FROM employees WHERE hire_date >= TO_DATE('01-
Jan-2002', 'DD-Mon-RR') AND hire_date <= TO_DATE('31-Dec-2002', 'DD-Mon-RR') AND
salary > 5000;
d. SELECT last_name, hire_date FROM employees WHERE hire_date >= TO_DATE('Jan-
2000', 'Month-YYYY') AND hire_date <= TO_DATE('Dec-2002', 'Month-‘YYYY') AND
salary > 5,000;

Question 12

Aldrin wants to know the outstanding total balance on hand on every class per warehouse.
Select one:
a. SELECT warehouse, class, onhand FROM parts GROUP BYsum(warehouse),
sum(class);
b. SELECT warehouse, class, sum(onhand) FROM parts GROUP BY warehouse, class
c. SELECT TOTAL(warehouse), TOTAL(class), TOTAL(onhand) FROM parts GROUP
BY warehouse, class
d. SELECT warehouse, class, onhand FROM parts GROUP BY warehouse, class

Question 13

You want to display the employee's id and formatted date hired as shown below.

Which SQL statement give the required output?

Required output :

Select one:
a. SELECT employee_id, TO_CHAR(hire_date, 'fmMonth DD, YYYY') AS "Hired Date"
FROM employees;
b. SELECT employee_id, format(TO_DATE(hire_date, 'Month DD, YYYY')) AS "Hired
Date" FROM employees;
c. SELECT employee_id, TO_CHAR(hire_date, 'Month DD, YYYY') AS "Hired Date"
FROM employees;
d. SELECT employee_id, TO_DATE (hire_date, 'format Month DD, YYYY') AS "Hired
Date" FROM employees;

Question 14

You want to display the employee id and the month an employee was hired.

Which SQL statement give the required output?

Required output :

Select one:
a. SELECT employee_id, TO_MONTH(hire_date,'Month') AS 'Hired Month'FROM
employees;
b. SELECT employee_id, hire_date, TO_CHAR(hire_date,'Month') AS "Hired Month"
FROM employees;
c. SELECT employee_id, DATE(hire_date,'Month') AS 'Hired Month'FROM employees;
d. SELECT employee_id, hire_date, MONTH(hire_date) AS "Hired Month" FROM
employees;

Question 15

Display the warehouse number, class, highest price & lowest price, total on hand balance whose
class is AP.

Sort the output by warehouse number.

Select one:
a. SELECT warehouse, class, MAX(price), MIN(PRICE), sum(onhand)
FROM parts
WHERE class = 'AP'
GROUP BY warehouse, class, price
ORDER BY warehouse, class
b. SELECT warehouse, class, HIGH(price), LOW(PRICE), SUM(onhand)
FROM parts
GROUP BY warehouse
WHERE class = 'AP'
ORDER BY warehouse, class;
c. SELECT warehouse, class, MAX(price), MIN(PRICE), sum(onhand)
FROM parts
WHERE class = 'AP'
GROUP BY warehouse, class
ORDER BY warehouse;
d. SELECT warehouse, class, MAX(price), MIN(PRICE), SUM(onhand)
FROM parts
GROUP BY warehouse, class
ORDER BY warehouse;
WHERE class = 'AP'

Question 16
You want to display all the employee id and the month an employee was hired excluding
employees whose job id is AD_VP. Which SQL statement give the required output?
Select one:
a. SELECT employee_id, hire_date, TO_MONTH(hire_date,'Month') AS "Hired Month",
job_id FROM employees WHERE job_id NOT ('AD_VP');
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');
c. SELECT employee_id, hire_date, MONTH(hire_date,'Month') AS "Hired Month",
job_id FROM employees WHERE job_id EXCLUDE ('AD_VP');
d. SELECT employee_id, hire_date, TO_DATE(hire_date,'Month') AS "Hired Month",
job_id FROM employees WHERE job_id NOT = 'AD_VP';

Question 17

There was 10% price increase in the all the parts in warehouse number 3. The Store Manager
asked the Database Administrator to generate a report showing the part number, the old and
new price.

Which of the following SQL statement would satisfy the requirement of the Store Manager.

Select one:
a. SELECT partnum, price, price * 10% FROM parts WHERE warehouse = 3
b. SELECT partnum, price, price * 0.1 FROM parts WHERE warehouse = 3
c. SELECT partnum, price, price * 1.1 FROM parts WHERE warehouse = 3
d. SELECT partnum, price, price * 1.10% FROM parts WHERE warehouse = 3

Question 18

What is the SQL command to display the date of the first employee that was hired?
Select one:
a. SELECT FIRST(hire_date) FROM employees;
b. SELECT hire_date FROM employees WHERE TO_CHAR(hire_date) = ‘FIRST’;
c. SELECT MIN(hire_date) FROM employees;
d. SELECT hire_date FROM employees WHERE FIRST(hire_date );

Question 19

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?

Required output :

Select one:
a. SELECT last_name, TO_NUMBER(salary, '$999,999.99') AS "MONTHLY SALARY"
FROM employees WHERE salary < 10,000
b. SELECT last_name, TO_INTEGER(salary, $999,999.99) AS "MONTHLY SALARY"
FROM employees WHERE salary < 10000
c. SELECT last_name, TO_INT(salary, '$999,999.99') AS "MONTHLY SALARY" FROM
employees WHERE salary < 10,000
d. SELECT last_name, TO_CHAR(salary, '$999,999.99') AS "MONTHLY SALARY"
FROM employees WHERE salary < 10000

Question 20

You want to display the employee's last name hired from year 2000 to 2002.

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')
b. SELECT last_name, hire_date FROM employees WHERE hire_date>= TO_DATE('01-
Jan-2000', '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('2000', 'YYYY') AND hire_date<= TO_DATE('2002', 'YYYY')
d. SELECT last_name, hire_date FROM employees WHERE hire_date>= TO_DATE('Jan-
2000', 'Month-YYYY') AND hire_date<= TO_DATE('Dec-2002', 'Month-‘YYYY')

Started on Wednesday, 1 January 2020, 6:25 PM


State Finished
Completed on Wednesday, 1 January 2020, 6:32 PM
Time taken 6 mins 48 secs
Grade 20.00 out of 20.00 (100%)

Question 1

John want to know how many part items are there in warehouse number 3.

What SQL command he need to run?

Select one:
a. SELECT * FROM COUNT(parts) WHERE warehouse = 3;
b. SELECT COUNT(*) FROM parts WHERE warehouse = 3;
c. SELECT partnum FROM COUNT(parts)WHERE warehouse = 3;
d. SELECT ALL FROM COUNT(parts) WHERE warehouse = 3;

Question 2

You want to display the employee’s last name whose salary is below 10,000 and whose
lastname starts with letter K.

Which SQL statement give the required output format of the salary?

Select one:
a. SELECT last_name, TO_NUMBER(salary, '$999,999.99') AS "MONTHLY SALARY"
FROM employees WHERE salary < 10,000WHERE last_name = ‘K%’
b. SELECT last_name, TO_INT(salary, '$999,999.99') AS "MONTHLY SALARY" FROM
employees WHERE salary < 10,000 WHERE last_name STARTS 'K%'
c. SELECT last_name, TO_CHAR(salary, '$999,999.99') AS "MONTHLY SALARY"
FROM employees WHERE salary < 10000WHERE last_name LIKE ‘K%’
d. SELECT last_name, TO_INTEGER(salary, $999,999.99) AS "MONTHLY SALARY"
FROM employees WHERE salary < 10000 WHERE last_name IN 'K%'

Question 3

You want to display the last name and the year when an employee was hired whose job id is
IT_PROG.

Which SQL statement give the required output?

Select one:
a. SELECT last_name, YEAR(hire_date') FROM employees WHERE job_id = ‘IT_PROG’;
b. SELECT last_name, YEAR(hire_date,'YYYY') FROM employees WHERE job_id =
‘IT_PROG’;
c. SELECT last_name, TO_YEAR(hire_date,'YYYY') FROM employees WHERE job_id =
‘IT_PROG’;
d. SELECT last_name, TO_CHAR(hire_date,'YYYY') FROM employees WHERE job_id =
‘IT_PROG’;

Question 4

What will be the output of the following SQL?

SELECT * FROM parts WHERE (warehouse = 1 or warehouse = 2) AND class IN ('HW', 'AP')
AND (price > 200 AND price < 500);

Select one:
a. 0 rows returned
b. Error
c. Invalid SQL command
d. 7 rows returned
e. 2 rows returned

Question 5

You want to display the employee's last name hired from year 2000 to 2002.

Which SQL statement give the required output?

Select one:
a. SELECT last_name, hire_date FROM employees WHERE hire_date>= TO_DATE('Jan-
2000', 'Month-YYYY') AND hire_date<= TO_DATE('Dec-2002', 'Month-‘YYYY')
b. SELECT last_name, hire_date FROM employees WHERE hire_date>= TO_DATE('01-
Jan-2000', '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('2000', 'YYYY') AND hire_date<= TO_DATE('2002', 'YYYY')
d. 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')

Question 6

Display the warehouse number, class, highest price & lowest price, total on hand balance whose
class is AP.

Sort the output by warehouse number.

Select one:
a. SELECT warehouse, class, HIGH(price), LOW(PRICE), SUM(onhand)
FROM parts
GROUP BY warehouse
WHERE class = 'AP'
ORDER BY warehouse, class;
b. SELECT warehouse, class, MAX(price), MIN(PRICE), sum(onhand)
FROM parts
WHERE class = 'AP'
GROUP BY warehouse, class, price
ORDER BY warehouse, class
c. SELECT warehouse, class, MAX(price), MIN(PRICE), SUM(onhand)
FROM parts
GROUP BY warehouse, class
ORDER BY warehouse;
WHERE class = 'AP'
d. SELECT warehouse, class, MAX(price), MIN(PRICE), sum(onhand)
FROM parts
WHERE class = 'AP'
GROUP BY warehouse, class
ORDER BY warehouse;

Question 7

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:
a. SELECT AVE(salary) FROM employees WHERE job_id = 'IT_PROG';
b. SELECT AVERAGE(salary) FROM employees WHERE job_id = 'IT_PROG';
c. SELECT AVG(salary) FROM employees WHERE job_id = 'IT_PROG';
d. SELECT COUNT AVG(salary) FROM employees WHERE job_id = 'IT_PROG';

Question 8

You want to display all the employee id and the month an employee was hired excluding
employees whose job id is AD_VP. Which SQL statement give the 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 ('AD_VP');
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');
c. SELECT employee_id, hire_date, TO_DATE(hire_date,'Month') AS "Hired Month",
job_id FROM employees WHERE job_id NOT = 'AD_VP';
d. SELECT employee_id, hire_date, TO_MONTH(hire_date,'Month') AS "Hired Month",
job_id FROM employees WHERE job_id NOT ('AD_VP');

Question 9

Aldrin wants to know the outstanding total balance on hand on every class per warehouse.
Select one:
a. SELECT warehouse, class, onhand FROM parts GROUP BYsum(warehouse),
sum(class);
b. SELECT TOTAL(warehouse), TOTAL(class), TOTAL(onhand) FROM parts GROUP
BY warehouse, class
c. SELECT warehouse, class, onhand FROM parts GROUP BY warehouse, class
d. SELECT warehouse, class, sum(onhand) FROM parts GROUP BY warehouse, class

Question 10

You want to display the employee id and the month an employee was hired.

Which SQL statement give the required output?

Required output :

Select one:
a. SELECT employee_id, TO_MONTH(hire_date,'Month') AS 'Hired Month'FROM
employees;
b. SELECT employee_id, hire_date, TO_CHAR(hire_date,'Month') AS "Hired Month"
FROM employees;
c. SELECT employee_id, DATE(hire_date,'Month') AS 'Hired Month'FROM employees;
d. SELECT employee_id, hire_date, MONTH(hire_date) AS "Hired Month" FROM
employees;

Question 11

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

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

Select one:
a. SELECT warehouse, class, SUM(partnum), SUM(onhand) FROM parts GROUP BY
warehouse,class HAVING warehouse = 1 AND warehouse = 2;
b. SELECT warehouse, class, COUNT(partnum), SUM(onhand) FROM parts GROUP BY
warehouse,class HAVING warehouse = 1 OR warehouse = 2;
c. SELECT warehouse, class, count(partnum), sum(onhand) GROUP BY warehouse,class
HAVING warehouse = 1 or warehouse = 2 FROM parts;
d. SELECT warehouse, class, count(partnum), sum(onhand) GROUP BY warehouse,class
WHERE warehouse = 1 or warehouse = 2 FROM parts;

Question 13

You want to display the employee id, date hired of all employees whose hired date is
September.

Which SQL statement give the required output?

Select one:
a. SELECT employee_id, hire_date, TO_CHAR(hire_date, 'Month') AS "Hired Month"
FROM employees WHERE TO_CHAR(hire_date, 'MON') = 'SEP'
b. SELECT employee_id, hire_date, TO_DATE(hire_date, 'Month') AS "Hired Month"
FROM employees WHERE TO_DATE(hire_date, 'MON') = 'SEP'
c. SELECT employee_id, hire_date, TO_CHAR(hire_date, 'Month') AS "Hired Month"
FROM employees WHERE TO_DATE(hire_date, 'Month') = TO_DATE(‘09’)
d. SELECT employee_id, hire_date, TO_CHAR(hire_date, 'Month') AS "Hired Month"
FROM employees WHERE TO_CHAR(hire_date, 'Month') = TO_DATE('September')

Question 14

You want to display the employee id and the year when an employee was hired.

Which SQL statement give the required output?

Select one:
a. SELECT employee_id, YEAR(hire_date') FROM employees;
b. SELECT employee_id, TO_YEAR(hire_date,'YYYY') FROM employees;
c. SELECT employee_id, YEAR(hire_date,'YYYY') FROM employees;
d. SELECT employee_id, TO_CHAR(hire_date,'YYYY') FROM employees;

Question 15

What is the SQL command to display the date of the first employee that was hired?
Select one:
a. SELECT hire_date FROM employees WHERE TO_CHAR(hire_date) = ‘FIRST’;
b. SELECT hire_date FROM employees WHERE FIRST(hire_date );
c. SELECT FIRST(hire_date) FROM employees;
d. SELECT MIN(hire_date) FROM employees;

Question 16

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;
b. SELECT last_name, hire_date FROM employees WHERE hire_date >= TO_DATE('01-
Jan-2002', 'DD-Mon-RR') AND hire_date <= TO_DATE('31-Dec-2002', 'DD-Mon-RR') AND
salary > 5000;
c. SELECT last_name, hire_date FROM employees WHERE hire_date >=
TO_DATE('2000', 'YYYY') AND hire_date <= TO_DATE('2002', 'YYYY') OR salary > 5000;
d. SELECT last_name, hire_date FROM employees WHERE hire_date >= TO_DATE('Jan-
2000', 'Month-YYYY') AND hire_date <= TO_DATE('Dec-2002', 'Month-‘YYYY') AND
salary > 5,000;

Question 17

There was 10% price increase in the all the parts in warehouse number 3. The Store Manager
asked the Database Administrator to generate a report showing the part number, the old and
new price.

Which of the following SQL statement would satisfy the requirement of the Store Manager.

Select one:
a. SELECT partnum, price, price * 1.1 FROM parts WHERE warehouse = 3
b. SELECT partnum, price, price * 10% FROM parts WHERE warehouse = 3
c. SELECT partnum, price, price * 0.1 FROM parts WHERE warehouse = 3
d. SELECT partnum, price, price * 1.10% FROM parts WHERE warehouse = 3

Question 18

The General Manager request to the Database Administrator to generate the total salary per
month of every department in the company.
Select one:
a. SELECT department_id, SUM(salary) FROM employees GROUP BY department_id
b. SELECT department_id, salary FROM employees GROUP BY SUM(salary) ORDER
BY department_id
c. SELECT department_id, TOTAL(salary) FROM employees GROUP BY department_id
d. SELECT department_id, salary FROM employees ORDER BY SUM(salary)

Question 19
What will be the output of the SQL command?
SELECT SUM(onhand) FROM PARTS where class = 'HW' OR class = 'AP' AND warehouse =
1;
Select one:
a. 178
b. 137
c. 44
d. 85

Question 20

Which of the following SQL command will display all records with part number contains the
number 9?
Select one:
a. SELECT partnum FROM parts WHERE partnum = ‘%9%’
b. SELECT * from parts WHERE partnum LIKE '%9%'
c. SELECT partnum FROM parts WHERE partnum BETWEEN = ‘%9%’
d. SELECT * FROM parts WHERE partnum IN ('%9%')

Started on Monday, 30 December 2019, 7:46 AM


State Finished
Completed on Monday, 30 December 2019, 8:04 AM
Time taken 18 mins 33 secs
Grade 18.00 out of 20.00 (90%)

Question 1

Evaluate the following SQL command


SELECT employee_id, hire_date, department_name FROM employees, departments
WHERE departments.department_id = employees.department_id
Select one:
a. The SQL command should have ALIAS for the table to produce a correct output.
b. The SQL command will produce a correct output.
c. The SQL command will give an incorrect output.
d. The SQL command will produce an error.

Question 2

Which of the following will is the correct command to create a role.


Select one:
a. None of the choices
b. CREATE gen_manager ROLE
c. GRANT ROLE gen_manager
d. CREATE ROLE gen_manager

Question 3
Matt wants to change his password from 1234 to abcd.
Which of the following will perform the task?
Select one:
a. UPDATE PASSWORD 1234 TO abcd FROM matt
b. CHANGE USER matt PASSWORD abcd
c. ALTER USER matt IDENTIFIED abcd;
d. User matt cannot change his password. DBA has only the rights to change the password
e. UPDATE matt WITH abcd

Question 4

These are privileges that performs a particular action within the database.
Select one:
a. Network Privileges
b. System Privileges
c. Connection Privileges
d. Object Privileges

Question 5

Nathaniel had accidentally deleted all the records in the newly updated ORACLE database
using the DELETE SQL command.
What is the best solution that he can do to restore all the deleted records in the database.
Select one:
a. Re-encode the data
b. Run the ROLLBACK command
c. None of the choices
d. Execute the UNDELETE command
e. Restore the backup copy

Question 6

TRUE OR FALSE.
A FOREIGN KEY is a field in one table that refers to the PRIMARY KEY in another table.
Select one:
True
False

Question 7

This has the highest level of privileges for task such as creating new users, removing users and
tables and backing up tables.
Select one:
a. Owner
b. SQL Developer
c. DBA
d. Manager
Question 8

These are collection of objects such as tables, views, and sequences.


Select one:
a. Model
b. Class
c. Schema
d. Container

Question 9

A join between two tables that returns the results of an INNER join as well as the results of a
left and right join is a _____________.
Select one:
a. FULL OUTER JOIN
b. NATURAL JOIN
c. INNER JOIN
d. OUTER JOIN

Question 10

TRUE OR FALSE.
Multiple fields in NOT allowed in a Foreign key.
Select one:
True
False

Question 11

Which of the following SQL command that the DBA will run to provide Matt to create a table
in the Oracle Database.
Select one:
a. GRANT matt create table
b. GRANT create table TO matt
c. GRANT matt TO create table
d. GRANT ACCESS matt TO create table

Question 12

Which of the following DOES NOT describes the state of the data after the COMMIT
command
Select one:
a. The previous state of the data is overwritten.
b. All users can view the results.
c. Locks on the affected rows are released; those rows are available for other users to
manipulate.
d. Data changes are saved in the database.
e. None of the choices
f. All savepoints are erased.

Question 13

What are the 2 types of security being applied to a database


Select one:
a. GRANT & REVOKE
b. UPDATE and DELETE SQL command
c. Data Manipulation and Data Control
d. Data and System

Question 14

You want to cancel the privilege of matt to retrieve records from the employees table.
Select one:
a. REVOKE select ON employees FROM matt;
b. REVOKE matt FROM employees TO select;
c. REVOKE select ON matt FROM employees;
d. REVOKE employees FROM matt TO select;

Question 15

INSERT, DELETE, UPDATE are ________________ commands


Select one:
a. DML
b. DDL
c. All of the choices
d. DCL

Question 16

A _______________ consists of a collection of DML statements that form a logical unit of


work.
Select one:
a. Database
b. All of the choices
c. Transaction
d. SQL command

Question 17

TRUE OR FALSE.
The INSERT statement can add multiple rows.
Select one:
True
False

Question 18
The DBA will create a new user name sales.

Which of the following SQL command will perform the creation?

Select one:
a. CREATE USER sales IDENTIFIED BY 1234
b. None of the choices
c. CREATE sales ACCESS 1234
d. CREATE USERNAME sales SET PASSWORD default
e. CREATE USER FR0M DB_USER SET user=’sales’ password=NULL

Question 19

Which of the following will erase all records in the departments table
Select one:
a. TRUNCATE FROM TABLE departments
b. DELETE * FROM departments
c. DELETE FROM departments
d. TRUNCATE TABLE departments

Question 20

What privileges that manipulates the content of the database objects.


Select one:
a. Network Privileges
b. System Privileges
c. Connection Privileges
d. Object Privileges

Started on Wednesday, 1 January 2020, 6:47 PM


State Finished
Completed on Wednesday, 1 January 2020, 7:00 PM
Time taken 13 mins 53 secs
Grade 18.00 out of 20.00 (90%)

Question 1

You want to cancel the privilege of matt to add records from the employees table.
Select one:
a. REVOKE insert ON employees FROM matt;
b. REVOKE employees FROM matt TO insert;
c. REVOKE insert ON matt FROM employees;
d. REVOKE matt FROM employees TO insert;

Question 2

Which of the following provide privilege to update the employees table?


Select one:
a. ALTER ROLE update GRANT ROLE employees
b. GRANT matt TO update ON employees
c. GRANT update (salary) ON employees TO matt
d. ALTER matt GRANT update ROLE employees

Question 3

A join between two tables that returns the results of the INNER join as well as
the_______________ rows from the left (or right) table is called a left (or right) OUTER join.
Select one:
a. Missing
b. Matched
c. Unmatched
d. Intersect

Question 4

A Database Administrator can create and remove users and tables.


Select one:
a. The statement is correct
b. The statement is incorrect. Only users of the database can be created by the Database
Administrator.
c. The information is insufficient.
d. The statement is incorrect. DBA can only create users and tables. Removal of users and
tables will be done by the higher authority of the database.

Question 5

Which of the following will grant a query privileges on the STUDENT table
Select one:
a. GRANT select ON student TO matt
b. GRANT select TO matt ON student
c. GRANT matt TO select student
d. GRANT matt PRIVILEGE select TO student

Question 6

Evaluate the given SQL syntax


INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...)
WHERE condition;
Select one:
a. Wrong placement of WHERE and VALUES
b. INSERT should be UPDATE command
c. This will produce an error.
d. Correct syntax.
Question 7

Given the DEPARTMENTS table and USER user1, evaluate the SQL command:

GRANT select

ON user1

TO departments;

Select one:
a. The folllowing will grant object privileges on USER user1
b. The SQL command is incorrect
c. None of the choices
d. The following will grant query privileges on the DEPARTMENTS table:

Question 8

Which of the following describes the command below?

SELECT * FROM employees WHERE department = 60 FOR UPDATE

Select one:
a. Creates a temporary table with department = 60
b. Locks the rows in the EMPLOYEES table with department id is 60.
c. Unlock all records with department id = 60
d. All users accessing the department id 60 can accept UPDATE command simultaneously.

Question 9

A Cartesian product is formed when:


Select one:
a. All of the choices
b. A join condition is invalid
c. All rows in the first table are joined to all rows in the second table
d. A join condition is omitted

Question 10

Question text

GRANT is a _____________________ command.


Select one:
a. DDL
b. DML
c. DCL
d. All of the choices

Question 11
Nathaniel had accidentally deleted all the records in the newly updated ORACLE database
using the DELETE SQL command.
What is the best solution that he can do to restore all the deleted records in the database.
Select one:
a. Restore the backup copy
b. Run the ROLLBACK command
c. Re-encode the data
d. None of the choices
e. Execute the UNDELETE command

Question 12

INSERT, DELETE, UPDATE are ________________ commands


Select one:
a. DCL
b. All of the choices
c. DDL
d. DML

Question 13

SQL command to create a marker in the current transaction.


Select one:
a. INDEX
b. SAVEPOINT
c. POINTER
d. SAVEMARKER
e. SAVEMORE

Question 14

Angelica is the Oracle Database Administrator. She was been assigned to create an access for
the newly hired employee named Matt to the Oracle Database.

Which of the following SQL command Angelica will execute?

Select one:
a. CREATE USER matt IDENTIFIED BY 1234
b. CREATE USERNAME matt PASSWORD 1234
c. None of the choices
d. CREATE matt ACCESS 1234
e. CREATE USER FR0M DB_USER SET user

Question 15

TRUE OR FALSE.
The INSERT statement can add multiple rows.
Select one:
True
False

Question 16

Which of the following command will delete all records in the table employees
Select one:
a. DELETE ALL FROM employees
b. DELETE FROM employees
c. DELETE employees WHERE ORASYS_REC > 0
d. DELETE ALL RECORDS employees

Question 17

TRUE OR FALSE.
An owner has all the privileges on the object.
Select one:
True
False

Question 18

INDEX is an example of _____________________ privilege.


Select one:
a. None of the choices
b. Data
c. Object
d. System

Question 19

Which of the following is NOT a task of a Database Administrator


Select one:
a. Removing users
b. Removing tables
c. None of the choices
d. Backing up tables
e. Creating new users

Question 20

This has the highest level of privileges for task such as creating new users, removing users and
tables and backing up tables.
Select one:
a. Owner
b. DBA
c. SQL Developer
d. Manager
Started on Wednesday, 1 January 2020, 7:14 PM
State Finished
Completed on Wednesday, 1 January 2020, 7:20 PM
Time taken 6 mins 3 secs
Grade 19.00 out of 20.00 (95%)

Question 1

A Cartesian product is formed when:


Select one:
a. A join condition is invalid
b. All of the choices
c. All rows in the first table are joined to all rows in the second table
d. A join condition is omitted

Question 2

INDEX is an example of _____________________ privilege.


Select one:
a. System
b. Object
c. Data
d. None of the choices

Question 3

Which of the following describes the command below?

SELECT * FROM employees WHERE department = 60 FOR UPDATE

Select one:
a. All users accessing the department id 60 can accept UPDATE command simultaneously.
b. Unlock all records with department id = 60
c. Creates a temporary table with department = 60
d. Locks the rows in the EMPLOYEES table with department id is 60.

Question 4

Which of the following will erase all records in the departments table
Select one:
a. TRUNCATE TABLE departments
b. TRUNCATE FROM TABLE departments
c. DELETE FROM departments
d. DELETE * FROM departments

Question 5

TRUE OR FALSE.
A FOREIGN KEY is a field in one table that refers to the PRIMARY KEY in another table.
Select one:
True
False

Question 6

Which of the following will grant a query privileges on the STUDENT table
Select one:
a. GRANT select ON student TO matt
b. GRANT select TO matt ON student
c. GRANT matt TO select student
d. GRANT matt PRIVILEGE select TO student

Question 7

What are the 2 types of security being applied to a database


Select one:
a. UPDATE and DELETE SQL command
b. GRANT & REVOKE
c. Data Manipulation and Data Control
d. Data and System

Question 8

You want to cancel the privilege of matt to add records from the employees table.
Select one:
a. REVOKE insert ON employees FROM matt;
b. REVOKE matt FROM employees TO insert;
c. REVOKE employees FROM matt TO insert;
d. REVOKE insert ON matt FROM employees;

Question 9

Given the DEPARTMENTS table and USER user1, evaluate the SQL command:

GRANT select

ON user1

TO departments;

Select one:
a. The folllowing will grant object privileges on USER user1
b. None of the choices
c. The SQL command is incorrect
d. The following will grant query privileges on the DEPARTMENTS table:

Question 10
A Database Administrator can create and remove users and tables.
Select one:
a. The statement is incorrect. Only users of the database can be created by the Database
Administrator.
b. The information is insufficient.
c. The statement is incorrect. DBA can only create users and tables. Removal of users and
tables will be done by the higher authority of the database.
d. The statement is correct

Question 11

Which of the following provide privilege to update the employees table?


Select one:
a. GRANT update (salary) ON employees TO matt
b. ALTER ROLE update GRANT ROLE employees
c. ALTER matt GRANT update ROLE employees
d. GRANT matt TO update ON employees

Question 12

GRANT is a _____________________ command.


Select one:
a. All of the choices
b. DDL
c. DML
d. DCL

Question 13

Which of the following is NOT a task of a Database Administrator


Select one:
a. Backing up tables
b. Removing tables
c. Removing users
d. None of the choices
e. Creating new users

Question 14

Which of the following command will delete all records in the table employees
Select one:
a. DELETE FROM employees
b. DELETE ALL RECORDS employees
c. DELETE ALL FROM employees
d. DELETE employees WHERE ORASYS_REC > 0

Question 15
You want to cancel the privilege of matt to retrieve records from the employees table.
Select one:
a. REVOKE matt FROM employees TO select;
b. REVOKE select ON employees FROM matt;
c. REVOKE select ON matt FROM employees;
d. REVOKE employees FROM matt TO select;

Question 16

Which of the following SQL command that the DBA will run to provide Matt to create a table
in the Oracle Database.
Select one:
a. GRANT matt TO create table
b. GRANT ACCESS matt TO create table
c. GRANT matt create table
d. GRANT create table TO matt

Question 17

What privileges that manipulates the content of the database objects.


Select one:
a. Connection Privileges
b. Network Privileges
c. System Privileges
d. Object Privileges

Question 18

TRUE OR FALSE.
Multiple fields in NOT allowed in a Foreign key.
Select one:
True
False

Question 19

Evaluate the given SQL syntax


INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...)
WHERE condition;
Select one:
a. This will produce an error.
b. Correct syntax.
c. INSERT should be UPDATE command
d. Wrong placement of WHERE and VALUES

Question 20
Which of the following DOES NOT describes the state of the data after the COMMIT
command
Select one:
a. All savepoints are erased.
b. All users can view the results.
c. Data changes are saved in the database.
d. None of the choices
e. The previous state of the data is overwritten.
f. Locks on the affected rows are released; those rows are available for other users to
manipulate.

Started on Wednesday, 1 January 2020, 7:29 PM


State Finished
Completed on Wednesday, 1 January 2020, 7:35 PM
Time taken 6 mins 13 secs
Grade 19.00 out of 20.00 (95%)

Question 1

Nathaniel had accidentally deleted all the records in the newly updated ORACLE database
using the DELETE SQL command.
What is the best solution that he can do to restore all the deleted records in the database.
Select one:
a. None of the choices
b. Restore the backup copy
c. Re-encode the data
d. Run the ROLLBACK command
e. Execute the UNDELETE command

Question 2

Matt wants to change his password from 1234 to abcd.


Which of the following will perform the task?
Select one:
a. User matt cannot change his password. DBA has only the rights to change the password
b. CHANGE USER matt PASSWORD abcd
c. UPDATE matt WITH abcd
d. UPDATE PASSWORD 1234 TO abcd FROM matt
e. ALTER USER matt IDENTIFIED abcd;

Question 3

Correct
Mark 1.00 out of 1.00
A join between two tables that returns the results of the INNER join as well as
the_______________ rows from the left (or right) table is called a left (or right) OUTER join.
Select one:
a. Matched
b. Unmatched
c. Intersect
d. Missing

Question 4

Angelica is the Oracle Database Administrator. She was been assigned to create an access for
the newly hired employee named Matt to the Oracle Database.

Which of the following SQL command Angelica will execute?

Select one:
a. CREATE USER matt IDENTIFIED BY 1234
b. None of the choices
c. CREATE USERNAME matt PASSWORD 1234
d. CREATE USER FR0M DB_USER SET user
e. CREATE matt ACCESS 1234

Question 5

A _______________ consists of a collection of DML statements that form a logical unit of


work.
Select one:
a. Transaction
b. All of the choices
c. SQL command
d. Database

Question 6

You want to cancel the privilege of matt to add records from the employees table.
Select one:
a. REVOKE matt FROM employees TO insert;
b. REVOKE employees FROM matt TO insert;
c. REVOKE insert ON employees FROM matt;
d. REVOKE insert ON matt FROM employees;

Question 7

This has the highest level of privileges for task such as creating new users, removing users and
tables and backing up tables.
Select one:
a. DBA
b. SQL Developer
c. Manager
d. Owner
Question 8

SQL command to create a marker in the current transaction.


Select one:
a. SAVEMORE
b. INDEX
c. POINTER
d. SAVEMARKER
e. SAVEPOINT

Question 9

A join between two tables that returns the results of an INNER join as well as the results of a
left and right join is a _____________.
Select one:
a. INNER JOIN
b. NATURAL JOIN
c. FULL OUTER JOIN
d. OUTER JOIN

Question 10

Which of the following will is the correct command to create a role.


Select one:
a. CREATE gen_manager ROLE
b. None of the choices
c. GRANT ROLE gen_manager
d. CREATE ROLE gen_manager

Question 11

You want to cancel the privilege of matt to retrieve records from the employees table.
Select one:
a. REVOKE select ON employees FROM matt;
b. REVOKE matt FROM employees TO select;
c. REVOKE employees FROM matt TO select;
d. REVOKE select ON matt FROM employees;

Question 12

Which of the following will grant a query privileges on the STUDENT table
Select one:
a. GRANT matt TO select student
b. GRANT select ON student TO matt
c. GRANT select TO matt ON student
d. GRANT matt PRIVILEGE select TO student

Question 13
These are collection of objects such as tables, views, and sequences.
Select one:
a. Class
b. Schema
c. Container
d. Model

Question 14

A Cartesian product is formed when:


Select one:
a. A join condition is invalid
b. A join condition is omitted
c. All of the choices
d. All rows in the first table are joined to all rows in the second table

Question 15

INSERT, DELETE, UPDATE are ________________ commands


Select one:
a. DDL
b. DML
c. All of the choices
d. DCL

Question 16

Evaluate the following SQL command


SELECT employee_id, hire_date, department_name FROM employees, departments
WHERE departments.department_id = employees.department_id
Select one:
a. The SQL command will produce a correct output.
b. The SQL command will give an incorrect output.
c. The SQL command should have ALIAS for the table to produce a correct output.
d. The SQL command will produce an error.

Question 17

The DBA will create a new user name sales.

Which of the following SQL command will perform the creation?

Select one:
a. CREATE USERNAME sales SET PASSWORD default
b. CREATE sales ACCESS 1234
c. None of the choices
d. CREATE USER FR0M DB_USER SET user=’sales’ password=NULL
e. CREATE USER sales IDENTIFIED BY 1234
Question 18

TRUE OR FALSE.
An owner has all the privileges on the object.
Select one:
True
False

Question 19

These are privileges that performs a particular action within the database.
Select one:
a. Network Privileges
b. Object Privileges
c. System Privileges
d. Connection Privileges

Question 20

Which of the following SQL command that the DBA will run to provide Matt to create a table
in the Oracle Database.
Select one:
a. GRANT ACCESS matt TO create table
b. GRANT matt TO create table
c. GRANT create table TO matt
d. GRANT matt create table

Started on Wednesday, 1 January 2020, 7:49 PM


State Finished
Completed on Wednesday, 1 January 2020, 7:55 PM
Time taken 5 mins 11 secs
Grade 20.00 out of 20.00 (100%)

GRANT is a _____________________ command.


Select one:
a. All of the choices
b. DCL
c. DDL
d. DML

Question 2

TRUE OR FALSE.
The INSERT statement can add multiple rows.
Select one:
True
False
Question 3

Evaluate the given SQL syntax


INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...)
WHERE condition;
Select one:
a. INSERT should be UPDATE command
b. Correct syntax.
c. Wrong placement of WHERE and VALUES
d. This will produce an error.

Question 4

Which of the following provide privilege to update the employees table?


Select one:
a. ALTER matt GRANT update ROLE employees
b. GRANT update (salary) ON employees TO matt
c. GRANT matt TO update ON employees
d. ALTER ROLE update GRANT ROLE employees

Question 5

The DBA will create a new user name sales.

Which of the following SQL command will perform the creation?

Select one:
a. None of the choices
b. CREATE USER sales IDENTIFIED BY 1234
c. CREATE sales ACCESS 1234
d. CREATE USERNAME sales SET PASSWORD default
e. CREATE USER FR0M DB_USER SET user=’sales’ password=NULL

Question 6

Which of the following SQL command that the DBA will run to provide Matt to create a table
in the Oracle Database.
Select one:
a. GRANT matt TO create table
b. GRANT create table TO matt
c. GRANT ACCESS matt TO create table
d. GRANT matt create table

Question 7

Nathaniel had accidentally deleted all the records in the newly updated ORACLE database
using the DELETE SQL command.
What is the best solution that he can do to restore all the deleted records in the database.
Select one:
a. Restore the backup copy
b. Run the ROLLBACK command
c. Re-encode the data
d. Execute the UNDELETE command
e. None of the choices

Question 8

These are collection of objects such as tables, views, and sequences.


Select one:
a. Class
b. Model
c. Container
d. Schema

Question 9

A Cartesian product is formed when:


Select one:
a. A join condition is omitted
b. All rows in the first table are joined to all rows in the second table
c. All of the choices
d. A join condition is invalid

Question 10

Given the DEPARTMENTS table and USER user1, evaluate the SQL command:

GRANT select

ON user1

TO departments;

Select one:
a. None of the choices
b. The SQL command is incorrect
c. The folllowing will grant object privileges on USER user1
d. The following will grant query privileges on the DEPARTMENTS table:

Question 11

TRUE OR FALSE.
Multiple fields in NOT allowed in a Foreign key.
Select one:
True
False
Question 12

A _______________ consists of a collection of DML statements that form a logical unit of


work.
Select one:
a. Database
b. SQL command
c. Transaction
d. All of the choices

Question 13

SQL command to create a marker in the current transaction.


Select one:
a. POINTER
b. INDEX
c. SAVEMARKER
d. SAVEPOINT
e. SAVEMORE

Question 14

A join between two tables that returns the results of the INNER join as well as
the_______________ rows from the left (or right) table is called a left (or right) OUTER join.
Select one:
a. Intersect
b. Matched
c. Unmatched
d. Missing

Question 15

INSERT, DELETE, UPDATE are ________________ commands


Select one:
a. All of the choices
b. DDL
c. DCL
d. DML

Question 16

Evaluate the following SQL command


SELECT employee_id, hire_date, department_name FROM employees, departments
WHERE departments.department_id = employees.department_id
Select one:
a. The SQL command will produce a correct output.
b. The SQL command will produce an error.
c. The SQL command should have ALIAS for the table to produce a correct output.
d. The SQL command will give an incorrect output.

Question 17

Matt wants to change his password from 1234 to abcd.


Which of the following will perform the task?
Select one:
a. UPDATE matt WITH abcd
b. CHANGE USER matt PASSWORD abcd
c. User matt cannot change his password. DBA has only the rights to change the password
d. ALTER USER matt IDENTIFIED abcd;
e. UPDATE PASSWORD 1234 TO abcd FROM matt

Question 18

Which of the following is NOT a task of a Database Administrator


Select one:
a. Backing up tables
b. Removing tables
c. None of the choices
d. Removing users
e. Creating new users

Question 19

What are the 2 types of security being applied to a database


Select one:
a. Data and System
b. Data Manipulation and Data Control
c. GRANT & REVOKE
d. UPDATE and DELETE SQL command

Question 20

Which of the following DOES NOT describes the state of the data after the COMMIT
command
Select one:
a. Data changes are saved in the database.
b. All savepoints are erased.
c. None of the choices
d. All users can view the results.
e. The previous state of the data is overwritten.
f. Locks on the affected rows are released; those rows are available for other users to
manipulate.
Angelica is the Oracle Database Administrator. She was been assigned to create an access for
the newly hired employee named Matt to the Oracle Database.

Which of the following SQL command Angelica will execute?

Select one:
a. None of the choices
b. CREATE USER FR0M DB_USER SET user
c. CREATE USERNAME matt PASSWORD 1234
d. CREATE matt ACCESS 1234
e. CREATE USER matt IDENTIFIED BY 1234

Display all employees id and remainder of the his/her salary after it is divided by 3,000 for all
employees with the job id of IT_PROG.
Select one:
a. SELECT employee_id, job_id, salary FROM employees WHERE job_id = 'IT_PROG'
AND MOD(salary, 3000)
b. SELECT employee_id, job_id, salary FROM employees WHERE job_id = 'IT_PROG'
AND salary/3000
c. SELECT employee_id, job_id, salary, salary/3000 FROM employees WHERE job_id =
'IT_PROG'
d. SELECT employee_id, job_id, salary, REM(salary/3000) FROM employees WHERE
job_id = 'IT_PROG'
e. SELECT employee_id, job_id, salary, MOD(salary, 3000) FROM employees WHERE
job_id = 'IT_PROG'

Started on Monday, 30 December 2019, 8:06 AM


State Finished
Completed on Monday, 30 December 2019, 8:47 AM
Time taken 41 mins
Grade 42.00 out of 50.00 (84%)

Question 1

Display the warehouse number, class, highest price & lowest price, total on hand balance whose class is AP.

Sort the output by warehouse number.

Select one:
a. SELECT warehouse, class, MAX(price), MIN(PRICE), SUM(onhand)
FROM parts
GROUP BY warehouse, class
ORDER BY warehouse;
WHERE class = 'AP'
b. SELECT warehouse, class, MAX(price), MIN(PRICE), sum(onhand)
FROM parts
WHERE class = 'AP'
GROUP BY warehouse, class
ORDER BY warehouse;
c. SELECT warehouse, class, MAX(price), MIN(PRICE), sum(onhand)
FROM parts
WHERE class = 'AP'
GROUP BY warehouse, class, price
ORDER BY warehouse, class
d. SELECT warehouse, class, HIGH(price), LOW(PRICE), SUM(onhand)
FROM parts
GROUP BY warehouse
WHERE class = 'AP'
ORDER BY warehouse, class;

Question 2

Which of the following will erase all records in the departments table
Select one:
a. TRUNCATE FROM TABLE departments
b. DELETE FROM departments
c. TRUNCATE TABLE departments
d. DELETE * FROM departments

Question 3

Which of the following is the correct report that will display the CLASS from table PARTS.
Select one:
a. SELECT * CLASS FROM PARTS;
b. SELECT CLASS AS CLASS FROM PARTS;
c. SELECT 'CLASS' FROM PARTS;
d. SELECT CLASS FROM PARTS;

Question 4

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

Question 5

Which of the following command will delete all records in the table employees
Select one:
a. DELETE ALL RECORDS employees
b. DELETE FROM employees
c. DELETE employees WHERE ORASYS_REC > 0
d. DELETE ALL FROM employees

Question 6

What are the 2 types of security being applied to a database


Select one:
a. Data and System
b. GRANT & REVOKE
c. Data Manipulation and Data Control
d. UPDATE and DELETE SQL command

Question 7

Which of the following describes the command below?

SELECT * FROM employees WHERE department = 60 FOR UPDATE

Select one:
a. Unlock all records with department id = 60
b. Creates a temporary table with department = 60
c. Locks the rows in the EMPLOYEES table with department id is 60.
d. All users accessing the department id 60 can accept UPDATE command simultaneously.

Question 8

Which of the following SELECT statement is the correct PL/SQL that will display all rows and columns?
Select one:
a. SELECT ALL FROM PARTS;
b. SELECT FROM TABLE PARTS;
c. SELECT TABLE PARTS;
d. SELECT * FROM PARTS;

Question 9

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 output.

Select one:
a. SELECT AVE(salary) FROM employees WHERE job_id = 'FI_ACCOUNT';
b. SELECT AVG(salary) FROM employees WHERE job_id = 'FI_ACCOUNT';
c. SELECT AVERAGE(salary) FROM employees WHERE job_id = 'FI_ACCOUNT';
d. SELECT COUNT AVG(salary) FROM employees WHERE job_id = 'FI_ACCOUNT';

Question 10

You want to cancel the privilege of matt to retrieve records from the employees table.
Select one:
a. REVOKE select ON employees FROM matt;
b. REVOKE employees FROM matt TO select;
c. REVOKE select ON matt FROM employees;
d. REVOKE matt FROM employees TO select;

Question 11

Which of the following SQL command that the DBA will run to provide Matt to create a table in the Oracle
Database.
Select one:
a. GRANT ACCESS matt TO create table
b. GRANT create table TO matt
c. GRANT matt create table
d. GRANT matt TO create table

Question 12

Which of the following is NOT a task of a Database Administrator


Select one:
a. None of the choices
b. Removing tables
c. Backing up tables
d. Removing users
e. Creating new users

Question 13

Evaluate the following SQL command


SELECT employee_id, min_salary, max_salary FROM employees, departments WHERE
salary>= 10000 && salary <= 20000
Select one:
a. The SQL command will produce an error.
b. The SQL will produce Cartesian Product
c. The SQL will display the employee id, department id and the minimum and maximum salary whose
salary is between 10000 and 20000.
d. The SQL command will give an incorrect output.

Question 14

TRUE OR FALSE.
A FOREIGN KEY is a field in one table that refers to the PRIMARY KEY in another table.
Select one:
True
False

Question 15

Display the first 5 letter in the surname of all the employees whose firstname starts with letter 'N'
Select one:
a. SELECT SUBSTR(last_name,1,5), first_name FROM employees WHERE SUBSTR(first_name,1,1) IN
'N'
b. SELECT SUBSTR(last_name,1,5), first_name FROM employees WHERE first_name IN 'N'
c. SELECT SUBSTR(surname,1,5), first_name FROM employees WHERE first_name = 'N'
d. SELECT SUBSTR(surname,1,5), first_name FROM employees WHERE SUBSTR(first_name,1,1) IN
'N'
e. SELECT SUBSTR(last_name,1,5), first_name FROM employees WHERE SUBSTR(first_name,1,1) =
'N'

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

Select one:
a. SELECT warehouse, class, count(partnum), sum(onhand) GROUP BY warehouse,class HAVING
warehouse = 1 or warehouse = 2 FROM parts;
b. SELECT warehouse, class, COUNT(partnum), SUM(onhand) FROM parts GROUP BY warehouse,class
HAVING warehouse = 1 OR warehouse = 2;
c. SELECT warehouse, class, count(partnum), sum(onhand) GROUP BY warehouse,class WHERE
warehouse = 1 or warehouse = 2 FROM parts;
d. SELECT warehouse, class, SUM(partnum), SUM(onhand) FROM parts GROUP BY warehouse,class
HAVING warehouse = 1 AND warehouse = 2;

Question 17

You want to display the employee id, date hired of all employees whose hired date is September.

Which SQL statement give the required output?

Select one:
a. SELECT employee_id, hire_date, TO_DATE(hire_date, 'Month') AS "Hired Month" FROM employees
WHERE TO_DATE(hire_date, 'MON') = 'SEP'
b. SELECT employee_id, hire_date, TO_CHAR(hire_date, 'Month') AS "Hired Month" FROM employees
WHERE TO_CHAR(hire_date, 'Month') = TO_DATE('September')
c. SELECT employee_id, hire_date, TO_CHAR(hire_date, 'Month') AS "Hired Month" FROM employees
WHERE TO_CHAR(hire_date, 'MON') = 'SEP'
d. SELECT employee_id, hire_date, TO_CHAR(hire_date, 'Month') AS "Hired Month" FROM employees
WHERE TO_DATE(hire_date, 'Month') = TO_DATE(‘09’)

Question 18

Display employee's name and id whose firstname starts with letter D and job id is IT_PROG.

Sort the output by department.

Select one:
a. SELECT employee_id, first_name, last_name FROM employees ORDER BY department_id WHERE
first_name LIKE 'D%' and job_id = 'IT_PROG'
b. SELECT employee_id, first_name, last_name FROM employees WHERE job_id = 'IT_PROG' OR
first_name LIKE 'D%' and ORDER BY department_id
c. SELECT employee_id, first_name, last_name FROM employees WHERE first_name LIKE 'D%' and
job_id = 'IT_PROG' ORDER BY department_id
d. SELECT employees FROM employee_id, first_name, last_name WHERE first_name LIKE ‘D%’ and
job_id = ‘IT_PROG’ ORDER BY department_id

Question 19

You want to display the employee’s last name whose salary is below 10,000 and whose lastname starts with
letter K.

Which SQL statement give the required output format of the salary?

Select one:
a. SELECT last_name, TO_INTEGER(salary, $999,999.99) AS "MONTHLY SALARY" FROM
employees WHERE salary < 10000 WHERE last_name IN 'K%'
b. SELECT last_name, TO_CHAR(salary, '$999,999.99') AS "MONTHLY SALARY" FROM employees
WHERE salary < 10000WHERE last_name LIKE ‘K%’
c. SELECT last_name, TO_NUMBER(salary, '$999,999.99') AS "MONTHLY SALARY" FROM
employees WHERE salary < 10,000WHERE last_name = ‘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%'

Question 20

John want to know how many part items are there in warehouse number 3.

What SQL command he need to run?

Select one:
a. SELECT COUNT(*) FROM parts WHERE warehouse = 3;
b. SELECT ALL FROM COUNT(parts) WHERE warehouse = 3;
c. SELECT partnum FROM COUNT(parts)WHERE warehouse = 3;
d. SELECT * FROM COUNT(parts) WHERE warehouse = 3;

Question 21

Create a SQL script to display the fullname of evey employee with the format Lastname, Firstname example
Santos, Arnold. Display the output in a single column. Label the column as Fullname
Select one:
a. SELECT CONCAT(last_name, first_name) FROM employees
b. SELECT CONCAT(last_name, first_name) AS Fullname FROM employees;
c. SELECT CONCAT(last_name, ',', first_name) AS Fullname FROM employees
d. SELECT CONCAT(CONCAT(last_name, ','), first_name) AS Fullname FROM employees;

Question 22

Display the employee's name, job title, job_id and the department name of employees with department id of
100.
Select one:
a. SELECT E.employee_id, J.job_title, e.job_id, D.department_name
FROM employees E
JOIN department D ON E.job_id = J.job_id
JOIN jobs J ON E.department_id = D.department_id
WHERE E.department_id = 100
b. SELECT E.employee_id, J.job_title, e.job_id, D.department_name
FROM jobs J
NATURAL JOIN department D ON E.job_id = J.job_id
NATURAL JOIN employees E ON E.department_id = D.department_id
WHERE E.department_id = 100
c. SELECT E.employee_id, J.job_title, e.job_id, D.department_name
FROM jobs J
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, D.department_name
FROM employees E
JOIN jobs J ON E.job_id = J.job_id
JOIN departments D ON E.department_id = D.department_id
WHERE E.department_id = 100

Question 23

List all employees except for IT_PROG job id.


Select one:
a. SELECT *FROM employees EXCEPT JOB_ID != 'IT_PROG'
b. All of the choices
c. SELECT *FROM employees WHERE JOB_ID NOT IN ('IT_PROG')
d. SELECT *FROM employees WHERE JOB_ID <> 'IT_PROG'

Question 24

What will be the SQL command if every employee will be given a productivity bonus which is equivalent to
3% of the monthly salary?
Display the employee id, salary and the productivity bonus.
Select one:
a. SELECT employee_id, salary FROM employees WHERE salary)
b. SELECT employee_id, salary, salary + (salary .03) FROM employees
c. SELECT employee_id, salary, salary * 1.03 FROM employees
d. SELECT employee_id, salary, salary * .03 FROM employees
e. SELECT employee_id, salary, salary * .30 FROM employees

Question 25

Which of the following SELECT statement is the correctreport that will combine the column PARTNUM and
DESCRIPTION put a literal character string "belongs to" in between the two columns then rename the column
as "NUMBER TITLE". Note put space before and after the character literal string to avoid no spaces in the
report.
Select one:
a. SELECT (PARTNUM|| THAT BELONGS TO ||DESCRIPTION) AS "NUMBER TITLE" FROM
PARTS;
b. SELECT (PARTNUM||' THAT BELONGS TO '||DESCRIPTION) AS "NUMBER TITLE" FROM
PARTS;
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 26

Which of the following is NOT a Data Manipulation Language?


Select one:
a. CREATE
b. DELETE
c. INSERT
d. SELECT
e. UPDATE

Question 27
Austin David was transferred to Purchasing Department. You are assigned to update the database.

Which of the following SQL command will satisfy the requirements?

Select one:
a. UPDATE department_id = 30 WHERE first_name = ‘David’ AND last_name = ‘Austin’
b. UPDATE employees SET department_id = 30 WHERE first_name = ‘David’ AND last_name = ‘Austin’
c. UPDATE first_name = ‘David’ AND last_name = ‘Austin’ FROM employees SET department_id = 30
d. UPDATE employees WHERE department_id = 30 SET first_name = ‘David’ AND last_name = ‘Austin’

Question 28

Display a summary table of the total quantity on hand above 50 very class per warehouse
Select one:
a. SELECT warehouse, class, sum(onhand) FROM parts GROUP BY warehouse HAVING
SUM(ONHAND) > 50
b. SELECT warehouse, class, sum(onhand) FROM parts GROUP BY warehouseWHERE
SUM(ONHAND) > 50
c. SELECT warehouse, class, sum(onhand) FROM parts GROUP BY warehouse,class HAVING
SUM(ONHAND) > 50
d. SELECT warehouse, class, sum(onhand) FROM parts WHERE SUM(ONHAND) > 50

Question 29

You want to generate the total salary per month of every department in the company.
Select one:
a. SELECT department_id, SUM(salary) FROM employees GROUP BY department_id
b. SELECT department_id, TOTAL(salary) FROM employees GROUP BY department_id
c. SELECT department_id, salary FROM employees ORDER BY SUM(salary)
d. SELECT department_id, salary FROM employees GROUP BY SUM(salary) ORDER BY department_id

Question 30

Using Data Manipulation Language, you can ADD columns in the table.
Select one:
True
False

Question 31

You want to display the employee id and the month an employee was hired.

Which SQL statement give the required output?

Required output :

Select one:
a. SELECT employee_id, TO_MONTH(hire_date,'Month') AS 'Hired Month'FROM employees;
b. SELECT employee_id, hire_date, MONTH(hire_date) AS "Hired Month" FROM employees;
c. SELECT employee_id, hire_date, TO_CHAR(hire_date,'Month') AS "Hired Month" FROM employees;
d. SELECT employee_id, DATE(hire_date,'Month') AS 'Hired Month'FROM employees;
Question 32

Evaluate the following SQL command


SELECT * FROM jobs WHERE job_title LIKE 'Manager%'
Select one:
a. The SQL command will display all records in the database
b. The SQL command will display all employees with Manager position
c. No records will be displayed
d. The SQL command will produce an error.

Question 33

The following are capabilities of SQL SELECT


Select one:
a. Projection, Selection, Join records
b. Grant priveledge, Add user
c. Create records, Remove Table, Edit record
d. Update, Delete, Add

Question 34

Which of the following SQL commands will display all stocks whose class is HW or AP.
Select one:
a. SELECT * FROM parts WHERE IN (class = ‘HW’, class= ‘AP’);
b. SELECT * FROM parts WHERE class IN ('HW', 'AP');
c. SELECT ALL FROM parts WHERE IN class = (‘HW’, ‘AP’);
d. SELECT * FROM parts WHERE IN class ('HW', 'AP');
e. SELECT ALL FROM class WHERE parts IN = (‘HW’, ‘AP’);

Question 35

What is the SQL command to count the number of records in the employees table?
Select one:
a. SELECT ALL FROM employees
b. SELECT * FROM employees;
c. SELECT COUNT(*) FROM employees
d. SELECT SUM(*) FROM employees;

Question 36

John want to know how many employees receiving salary below 10,000.

What SQL command he need to run?

Select one:
a. SELECT salary FROM COUNT(employees)WHERE salary < 10000;
b. SELECT COUNT(salary) FROM employees WHERE salary < 10,000;
c. SELECT COUNT(*) FROM employees WHERE salary < 10000;
d. SELECT COUNT(emp_id) FROM employees WHERE salary <= 10000;

Question 37
Display all location id between 1000 to 2000.
Select one:
a. DISPLAY location_id FROM departments WHERE location_id LING 1000 UP TO 2000
b. SELECT location_id FROM departments WHERE location_id BETWEEN 1000 AND 2000
c. SELECT location_id FROM departments WHERE location_id IN 1000 AND 2000
d. DISPLAY location_id FROM departments WHERE location_id BETWEEN 1000 TO 2000

Question 38

Display part number description and warehouse number whose part number starts with letter K.
Select one:
a. SELECT partnum, description, warehouse FROM parts WHERE partnum LIKE '*K*';
b. SELECT partnum, description, warehouse FROM parts WHERE partnum = LIKE ‘K%’;
c. SELECT partnumber, description, warehouse FROM parts WHERE partnum = LIKE ‘K%’;
d. SELECT * FROM parts WHERE partnum LIKE 'K_';
e. SELECT * FROM parts WHERE partnum LIKE 'K%';
f. SELECT partnum, description, warehouse FROM parts WHERE partnum LIKE 'K%';
g. SELECT partnumber, description, warehouse FROM parts WHERE partnum LIKE 'K*';

Question 39

You want to display the employee's last name whose salary is below 10,000 and whose lastname starts with
letter D.

Which SQL statement give the required output format of the salary?

Select one:
a. SELECT last_name, TO_NUMBER(salary, '$999,999.99') AS "MONTHLY SALARY" FROM
employees WHERE salary < 10,000 WHERE last_name = ‘D%’
b. SELECT last_name, TO_CHAR(salary, '$999,999.99') AS "MONTHLY SALARY" FROM employees
WHERE salary < 10000 WHERE last_name LIKE 'D%'
c. SELECT last_name, TO_INTEGER(salary, $999,999.99) AS "MONTHLY SALARY" FROM
employees WHERE salary < 10000 WHERE last_name IN 'D%'
d. SELECT last_name, TO_INT(salary, '$999,999.99') AS "MONTHLY SALARY" FROM employees
WHERE salary < 10,000 WHERE last_name STARTS 'D%'

Question 40

These are privileges that performs a particular action within the database.
Select one:
a. Network Privileges
b. Connection Privileges
c. System Privileges
d. Object Privileges

Question 41

The General Manager request to the Database Administrator to generate the total salary per month of every
department in the company.
Select one:
a. SELECT department_id, salary FROM employees GROUP BY SUM(salary) ORDER BY department_id
b. SELECT department_id, salary FROM employees ORDER BY SUM(salary)
c. SELECT department_id, SUM(salary) FROM employees GROUP BY department_id
d. SELECT department_id, TOTAL(salary) FROM employees GROUP BY department_id

Question 42

GRANT is a _____________________ command.


Select one:
a. All of the choices
b. DML
c. DDL
d. DCL

Question 43

What will be the output of the following SQL?

SELECT * FROM parts WHERE (warehouse = 1 or warehouse = 2) AND class IN ('HW', 'AP') AND (price >
200 AND price < 500);

Select one:
a. 7 rows returned
b. Invalid SQL command
c. 0 rows returned
d. 2 rows returned
e. Error

Question 44

Display the lastname of every employee in the company. Display the output in a single column and label it as
Fullname
Format: JuanReyes
Select one:
a. SELECT CONCAT(first_name, last_name) FROM employees
b. SELECT CONCATENATE(first_name, last_name) AS Fullname FROM employees
c. SELECT CONCAT(first_name, last_name) AS Fullname FROM employees
d. None of the choices

Question 45

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 employees WHERE hire_date>=
TO_DATE('Jan-2000', 'Month-YYYY') AND hire_date<= TO_DATE('Dec-2006', 'Month-‘YYYY') AND
salary > 5,000;
b. 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-2006', 'DD-Mon-
YYYY') AND salary ABOVE 5000;
c. SELECT last_name, hire_date FROM employees WHERE hire_date>=
TO_DATE('2000', 'YYYY') AND hire_date<= TO_DATE('2006', 'YYYY') OR salary > 5000;
d. SELECT last_name, hire_date FROM employees WHERE hire_date>=
TO_DATE('01-Jan-2006', 'DD-Mon-RR') AND hire_date<= TO_DATE('31-Dec-2006', 'DD-Mon-RR') AND
salary > 5000;

Question 46

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 salary >= 5000 AND salary <= 10000
b. SELECT job_title FROM jobs WHERE min_salary >= 5000 AND max_salary<= 10000
c. SELECT employees_id, job_title FROM employees WHERE salary >= 5000 AND salary <= 10000
d. SELECT job_title FROM employees WHERE salary >= 5000 AND salary <= 10000

Question 47

List all the employee_id of all employees whose salary is 5000 and below and belong to department 60 or 100.
Select one:
a. SELECT employee_id FROM employee WHERE salary < 5000 AND department_id IN ('60,'100')
b. SELECT employee_id,salary, department_id FROM employees WHERE salary < 5000 AND
department_id IN (60 OR 100)
c. SELECT employees FROM employee_id,salary, department_idWHERE salary < 5000 AND
department_id IN (60,100)
d. SELECT employee_id,salary, department_id FROM employees WHERE salary < 5000 AND
department_id IN (60,100)

Question 48

Display the employee id, salary, number of years and the hiring date of every employee in the company.
Select one:
a. SELECT employee_id, salary, hire_date, hire_date /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, hire_date- SYSDATE /365 FROM employees;

Question 49

Display all the records in the employee table. Arrange the output in by lastname from A-Z order.
Select one:
a. SELECT * FROM employees SORT BY lastname ascending
b. SELECT * FROM employees ORDER BY lastname AZ
c. SELECT * FROM employees SORT BY lastname
d. SELECT * FROM employees ORDER BY lastname

Question 50

You want to display all the employee id and the month an employee was hired.
Which SQL statement give the required output?
Select one:
a. SELECT employee_id, hire_date, TO_MONTH(hire_date,'Month') AS "Hired Month", job_id FROM
employees
b. SELECT employee_id, hire_date, TO_CHAR(hire_date,'Month') AS "Hired Month", job_id FROM
employees
c. SELECT employee_id, hire_date, MONTH(hire_date,'Month') AS "Hired Month", job_id FROM
employees
d. SELECT employee_id, hire_date, TO_DATE(hire_date,'Month') AS "Hired Month", job_id FROM

Started on Wednesday, 1 January 2020, 9:23 PM


State Finished
Completed on Wednesday, 1 January 2020, 9:43 PM
Time taken 19 mins 30 secs
Grade 50.00 out of 50.00 (100%)

Question 1

Which of the following SELECT statement is the correct report that will deduct 5 from ONHAND, multiply 5
in WAREHOUSE, after getting the value on both ONHAND and WAREHOUSE add their data: as shown
below: ONHAND - 5 + 5 * WAREHOUSE
Note that you have to force the Oracle to prioritize first the Subtraction over Multiplication. List only the
column DESCRIPTION, ONHAND and WAREHOUSE.
Select one:
a. SELECT ONHAND-5 + 5 * WAREHOUSE, DESCRIPTION FROM PARTS;
b. SELECT (ONHAND-5) + 5 * WAREHOUSE, DESCRIPTION FROM PARTS;
c. SELECT ONHAND-5 + 5 (* WAREHOUSE), DESCRIPTION FROM PARTS;
d. SELECT (ONHAND-5) + 5(* WAREHOUSE), DESCRIPTION FROM PARTS;

Question 2

True or False. The AND, OR, NOT are comparison operators.


Select one:
True
False

Question 3

Display the employee id, salary, number of years and the hiring date of every employee in the company.
Select one:
a. SELECT employee_id, salary, hire_date, ROUND((SYSDATE - hire_date) /365,0) FROM employees;
b. SELECT employee_id, salary, hire_date, hire_date /365 FROM employees;
c. SELECT employee_id,salary, hire_date, hire_date- SYSDATE /365 FROM employees;

Question 4

Which of the following SQL command will display all records with part number contains the number 9?
Select one:
a. SELECT partnum FROM parts WHERE partnum = ‘%9%’
b. SELECT partnum FROM parts WHERE partnum BETWEEN = ‘%9%’
c. SELECT * from parts WHERE partnum LIKE '%9%'
d. SELECT * FROM parts WHERE partnum IN ('%9%')

Question 5

In creating Joins,the NATURALJOIN and USING clauses are____________


Select one:
a. Mutually Exclusive
b. Limited to 2 relational tables
c. Opposite
d. Mutually Inclusive

Question 6

Which of the following will is the correct command to create a role.


Select one:
a. None of the choices
b. CREATE ROLE gen_manager
c. GRANT ROLE gen_manager
d. CREATE gen_manager ROLE

Question 7

This has the highest level of privileges for task such as creating new users, removing users and tables and
backing up tables.
Select one:
a. Owner
b. Manager
c. SQL Developer
d. DBA

Question 8

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.

Select one:
a. SELECT warehouse, class, count(partnum), sum(onhand) GROUP BY warehouse,class HAVING
warehouse = 1 or warehouse = 2 FROM parts;
b. SELECT warehouse, class, COUNT(partnum), SUM(onhand) FROM parts GROUP BY warehouse,class
HAVING warehouse = 1 OR warehouse = 2;
c. SELECT warehouse, class, count(partnum), sum(onhand) GROUP BY warehouse,class WHERE
warehouse = 1 or warehouse = 2 FROM parts;
d. SELECT warehouse, class, SUM(partnum), SUM(onhand) FROM parts GROUP BY warehouse,class
HAVING warehouse = 1 AND warehouse = 2;

Question 9

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 output.

Select one:
a. SELECT AVE(salary) FROM employees WHERE job_id = 'FI_ACCOUNT';
b. SELECT COUNT AVG(salary) FROM employees WHERE job_id = 'FI_ACCOUNT';
c. SELECT AVERAGE(salary) FROM employees WHERE job_id = 'FI_ACCOUNT';
d. SELECT AVG(salary) FROM employees WHERE job_id = 'FI_ACCOUNT';

Question 10

The DBA will create a new user name sales.

Which of the following SQL command will perform the creation?

Select one:
a. CREATE USER sales IDENTIFIED BY 1234
b. None of the choices
c. CREATE USERNAME sales SET PASSWORD default
d. CREATE USER FR0M DB_USER SET user=’sales’ password=NULL
e. CREATE sales ACCESS 1234

Question 11

These are collection of objects such as tables, views, and sequences.


Select one:
a. Model
b. Schema
c. Class
d. Container

Question 12

You want to display the employee id and the year when an employee was hired.

Which SQL statement give the required output?

Select one:
a. SELECT employee_id, YEAR(hire_date,'YYYY') FROM employees;
b. SELECT employee_id, TO_YEAR(hire_date,'YYYY') FROM employees;
c. SELECT employee_id, YEAR(hire_date') FROM employees;
d. SELECT employee_id, TO_CHAR(hire_date,'YYYY') FROM employees;

Question 13

Aldrin wants to know the outstanding total balance on hand on every class per warehouse.
Select one:
a. SELECT TOTAL(warehouse), TOTAL(class), TOTAL(onhand) FROM parts GROUP BY warehouse,
class
b. SELECT warehouse, class, onhand FROM parts GROUP BY warehouse, class
c. SELECT warehouse, class, onhand FROM parts GROUP BYsum(warehouse), sum(class);
d. SELECT warehouse, class, sum(onhand) FROM parts GROUP BY warehouse, class

Question 14

What will be the output of the SQL command?


SELECT SUM(onhand) FROM PARTS where class = 'HW' OR class = 'AP' AND warehouse = 1;
Select one:
a. 178
b. 137
c. 44
d. 85

Question 15

What is the SQL command to count the number of records in the employees table?
Select one:
a. SELECT * FROM employees;
b. SELECT ALL FROM employees
c. SELECT SUM(*) FROM employees;
d. SELECT COUNT(*) FROM employees

Question 16

Every employee will get a bonus of 150% of his/her current salary. Display the employee id, salary and the
bonus of every employee. Label the computed bonus with Bonus
Select one:
a. SELECT employee_id, salary, salary * 1.50% AS Bonus FROM employees
b. SELECT employee_id, salary, salary * 150 AS "Bonus" FROM employees
c. SELECT employee_id, salary, salary * 1.5 AS Bonus FROM employees
d. SELECT employee_id, salary, salary * 150% AS "Bonus" FROM employees

Question 17

Display the employee id, number of years and the hiring date of every employee in the company.
Select one:
a. SELECT employee_id, hire_date, ROUND((SYSDATE - hire_date),0 /365,0) FROM employees;
b. SELECT employee_id, hire_date, ROUND((SYSDATE - hire_date) /365,0) FROM employees;
c. SELECT employee_id, hire_date, hire_date /365 FROM employees;
d. SELECT employee_id, hire_date, hire_date- SYSDATE /365 FROM employees;

Question 18

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 salary >= 5000 AND salary <= 10000
b. SELECT job_title FROM employees WHERE salary >= 5000 AND salary <= 10000
c. SELECT employees_id, job_title FROM employees WHERE salary >= 5000 AND salary <= 10000
d. SELECT job_title FROM jobs WHERE min_salary >= 5000 AND max_salary<= 10000

Question 19

Display all the employee's id and salary whose annual salary is from 100,000 to 200,000. Arrange the output by
salary in descending order.
Select one:
a. SELECT employee_id, salary FROM employees WHERE salary >= 100000 AND salary <= 200000
ORDER BY salary
b. SELECT employee_id, salary FROM employees WHERE salary *12 >= 100000 AND salary *12 <=
200000 ORDER BY salary desc
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 WHERE salary *12 >= 100000 AND salary *12 <=
200000 ORDER BY salary

Question 20

You want to display the employee's id and formatted date hired as shown below.

Which SQL statement give the required output?

Required output :

Select one:
a. SELECT employee_id, TO_DATE (hire_date, 'format Month DD, YYYY') AS "Hired Date" FROM
employees;
b. SELECT employee_id, TO_CHAR(hire_date, 'fmMonth DD, YYYY') AS "Hired Date" FROM
employees;
c. SELECT employee_id, format(TO_DATE(hire_date, 'Month DD, YYYY')) AS "Hired Date" FROM
employees;
d. SELECT employee_id, TO_CHAR(hire_date, 'Month DD, YYYY') AS "Hired Date" FROM employees;

Question 21

Which of the following provide privilege to update the employees table?


Select one:
a. ALTER matt GRANT update ROLE employees
b. ALTER ROLE update GRANT ROLE employees
c. GRANT matt TO update ON employees
d. GRANT update (salary) ON employees TO matt

Question 22

There was 10% price increase in the all the parts in warehouse number 3. The Store Manager asked the
Database Administrator to generate a report showing the part number, the old and new price.

Which of the following SQL statement would satisfy the requirement of the Store Manager.

Select one:
a. SELECT partnum, price, price * 0.1 FROM parts WHERE warehouse = 3
b. SELECT partnum, price, price * 1.1 FROM parts WHERE warehouse = 3
c. SELECT partnum, price, price * 10% FROM parts WHERE warehouse = 3
d. SELECT partnum, price, price * 1.10% FROM parts WHERE warehouse = 3

Question 23

Evaluate the following SQL command


SELECT employee_id, min_salary, max_salary FROM employees, departments WHERE
salary>= 10000 && salary <= 20000
Select one:
a. The SQL will display the employee id, department id and the minimum and maximum salary whose
salary is between 10000 and 20000.
b. The SQL command will produce an error.
c. The SQL command will give an incorrect output.
d. The SQL will produce Cartesian Product

Question 24

Display employee's name and id whose firstname starts with letter D and job id is IT_PROG.

Sort the output by department.

Select one:
a. SELECT employee_id, first_name, last_name FROM employees WHERE first_name LIKE 'D%' and
job_id = 'IT_PROG' ORDER BY department_id
b. SELECT employees FROM employee_id, first_name, last_name WHERE first_name LIKE ‘D%’ and
job_id = ‘IT_PROG’ ORDER BY department_id
c. SELECT employee_id, first_name, last_name FROM employees WHERE job_id = 'IT_PROG' OR
first_name LIKE 'D%' and ORDER BY department_id
d. SELECT employee_id, first_name, last_name FROM employees ORDER BY department_id WHERE
first_name LIKE 'D%' and job_id = 'IT_PROG'

Question 25

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 order.
Select one:
a. SELECT first_name, last_name, salary FROM employees WHERE salary < 8000 AND department_id =
100 AND ORDER BY department_id
b. SELECT name, salary FROM employees WHERE department_id = 100 AND salary < 8000 ORDER
BY salary ASC
c. SELECT first_name, last_name, salary FROM employees WHERE department_id = 100 AND salary <
8000 ORDER BY salary
d. SELECT name FROM employees WHERE salary < 8000 AND department_id = 100 AND ORDER BY
department_id
e. SELECT first_name, last_name, salary FROM employees ORDER BY salary WHERE department_id =
100 AND salary > 8000
f. SELECT employees FROM first_name, last_name, salary WHERE department_id = 100 AND salary <
8000 ORDER BY salary ASC

Question 26

Display the employee id and the last name of every employee in the company whose salary is between 5000 to
10000. Display the output in a single column with the format 100 : King Label the column as Employee
Select one:
a. SELECT CONCAT(CONCAT(employee_id, ':'), last_name) AS Employee FROM employees WHERE
salary >= 5000 AND salary <= 10000
b. SELECT CONCAT(employee_id, ':', last_name) AS Employee, salary FROM employees WHERE
salary BETWEEN 5000 TO 10000
c. SELECT CONCAT(employee_id,last_name) AS Employee FROM employees WHERE salary >5000
AND 10000
d. SELECT CONCAT(CONCAT(employee_id, ':'), last_name) AS Employee, salary FROM employees
WHERE salary >= 5000 AND salary <= 10000

Question 27
A Cartesian product is formed when:
Select one:
a. A join condition is omitted
b. All rows in the first table are joined to all rows in the second table
c. A join condition is invalid
d. All of the choices

Question 28

Evaluate the following SQL command


SELECT * FROM jobs WHERE job_title LIKE 'Manager%'
Select one:
a. The SQL command will display all employees with Manager position
b. The SQL command will display all records in the database
c. The SQL command will produce an error.
d. No records will be displayed

Question 29

John want to know how many employees receiving salary below 10,000.

What SQL command he need to run?

Select one:
a. SELECT COUNT(salary) FROM employees WHERE salary < 10,000;
b. SELECT salary FROM COUNT(employees)WHERE salary < 10000;
c. SELECT COUNT(emp_id) FROM employees WHERE salary <= 10000;
d. SELECT COUNT(*) FROM employees WHERE salary < 10000;

Question 30

A join between two tables that returns the results of an INNER join as well as the results of a left and right join
is a _____________.
Select one:
a. OUTER JOIN
b. FULL OUTER JOIN
c. INNER JOIN
d. NATURAL JOIN

Question 31

Display the warehouse number, class, highest price & lowest price, total on hand balance whose class is AP.

Sort the output by warehouse number.

Select one:
a. SELECT warehouse, class, MAX(price), MIN(PRICE), sum(onhand)
FROM parts
WHERE class = 'AP'
GROUP BY warehouse, class
ORDER BY warehouse;
b. SELECT warehouse, class, MAX(price), MIN(PRICE), SUM(onhand)
FROM parts
GROUP BY warehouse, class
ORDER BY warehouse;
WHERE class = 'AP'
c. SELECT warehouse, class, HIGH(price), LOW(PRICE), SUM(onhand)
FROM parts
GROUP BY warehouse
WHERE class = 'AP'
ORDER BY warehouse, class;
d. SELECT warehouse, class, MAX(price), MIN(PRICE), sum(onhand)
FROM parts
WHERE class = 'AP'
GROUP BY warehouse, class, price
ORDER BY warehouse, class

Question 32

Ronnie is the stockman in the warehouse of ATR Corporation. The General Manager wants to know the parts
whose price is above 10000 and above. Which of the following SQL command that Ronnie will run to generate
the list.
Select one:
a. SELECT ALL FROM parts WHERE price < 10000;
b. SELECT parts FROM price WHERE price >= 10000;
c. SELECT * FROM parts WHERE price > 10000;
d. SELECT ALL FROM parts WHERE price > ‘10000’;
e. SELECT * FROM parts WHERE price <= 10000;
f. SELECT * FROM parts WHERE price >= 10000;

Question 33

Display the employee's name, job title, job_id and the department name of employees with department id of
100.
Select one:
a. SELECT E.employee_id, J.job_title, e.job_id, D.department_name
FROM jobs J
NATURAL JOIN department D ON E.job_id = J.job_id
NATURAL JOIN employees E ON E.department_id = D.department_id
WHERE E.department_id = 100
b. SELECT E.employee_id, J.job_title, e.job_id, D.department_name
FROM jobs J
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
c. SELECT E.employee_id, J.job_title, e.job_id, D.department_name
FROM employees E
JOIN jobs J ON E.job_id = J.job_id
JOIN departments D ON E.department_id = D.department_id
WHERE E.department_id = 100
d. SELECT E.employee_id, J.job_title, e.job_id, D.department_name
FROM employees E
JOIN department D ON E.job_id = J.job_id
JOIN jobs J ON E.department_id = D.department_id
WHERE E.department_id = 100
Question 34

What privileges that manipulates the content of the database objects.


Select one:
a. Connection Privileges
b. Network Privileges
c. Object Privileges
d. System Privileges

Question 35

Display the lastname of every employee in the company. Display the output in a single column and label it as
Fullname
Format: JuanReyes
Select one:
a. None of the choices
b. SELECT CONCATENATE(first_name, last_name) AS Fullname FROM employees
c. SELECT CONCAT(first_name, last_name) AS Fullname FROM employees
d. SELECT CONCAT(first_name, last_name) FROM employees

Question 36

Display the first 5 letter in the surname of all the employees whose firstname starts with letter 'N'
Select one:
a. SELECT SUBSTR(surname,1,5), first_name FROM employees WHERE SUBSTR(first_name,1,1) IN
'N'
b. SELECT SUBSTR(last_name,1,5), first_name FROM employees WHERE SUBSTR(first_name,1,1) =
'N'
c. SELECT SUBSTR(last_name,1,5), first_name FROM employees WHERE SUBSTR(first_name,1,1) IN
'N'
d. SELECT SUBSTR(last_name,1,5), first_name FROM employees WHERE first_name IN 'N'
e. SELECT SUBSTR(surname,1,5), first_name FROM employees WHERE first_name = 'N'

Question 37

Angelica is the Oracle Database Administrator. She was been assigned to create an access for the newly hired
employee named Matt to the Oracle Database.

Which of the following SQL command Angelica will execute?

Select one:
a. CREATE matt ACCESS 1234
b. CREATE USER matt IDENTIFIED BY 1234
c. None of the choices
d. CREATE USERNAME matt PASSWORD 1234
e. CREATE USER FR0M DB_USER SET user

Question 38

Austin David was transferred to Purchasing Department. You are assigned to update the database.

Which of the following SQL command will satisfy the requirements?


Select one:
a. UPDATE employees SET department_id = 30 WHERE first_name = ‘David’ AND last_name = ‘Austin’
b. UPDATE first_name = ‘David’ AND last_name = ‘Austin’ FROM employees SET department_id = 30
c. UPDATE employees WHERE department_id = 30 SET first_name = ‘David’ AND last_name = ‘Austin’
d. UPDATE department_id = 30 WHERE first_name = ‘David’ AND last_name = ‘Austin’

Question 39

You want to display the employee id, date hired of all employees whose hired date is September.

Which SQL statement give the required output?

Select one:
a. SELECT employee_id, hire_date, TO_DATE(hire_date, 'Month') AS "Hired Month" FROM employees
WHERE TO_DATE(hire_date, 'MON') = 'SEP'
b. SELECT employee_id, hire_date, TO_CHAR(hire_date, 'Month') AS "Hired Month" FROM employees
WHERE TO_CHAR(hire_date, 'MON') = 'SEP'
c. SELECT employee_id, hire_date, TO_CHAR(hire_date, 'Month') AS "Hired Month" FROM employees
WHERE TO_CHAR(hire_date, 'Month') = TO_DATE('September')
d. SELECT employee_id, hire_date, TO_CHAR(hire_date, 'Month') AS "Hired Month" FROM employees
WHERE TO_DATE(hire_date, 'Month') = TO_DATE(‘09’)

Question 40

You want to display the employee's last name hired from year 2000 to 2002.

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')
b. SELECT last_name, hire_date FROM employees WHERE hire_date>= TO_DATE('2000', 'YYYY')
AND hire_date<= TO_DATE('2002', 'YYYY')
c. SELECT last_name, hire_date FROM employees WHERE hire_date>= TO_DATE('01-Jan-2000', 'DD-
Mon-RR') AND hire_date<= TO_DATE('31-Dec-2002', 'DD-Mon-RR')
d. SELECT last_name, hire_date FROM employees WHERE hire_date>= TO_DATE('Jan-2000', 'Month-
YYYY') AND hire_date<= TO_DATE('Dec-2002', 'Month-‘YYYY')

Question 41

Display all location id between 1000 to 2000.


Select one:
a. DISPLAY location_id FROM departments WHERE location_id LING 1000 UP TO 2000
b. SELECT location_id FROM departments WHERE location_id BETWEEN 1000 AND 2000
c. DISPLAY location_id FROM departments WHERE location_id BETWEEN 1000 TO 2000
d. SELECT location_id FROM departments WHERE location_id IN 1000 AND 2000

Question 42

Each row of data in a table can be uniquely identified by a


Select one:
a. primary key
b. index key
c. local key
d. relational key
e. foreign key

Question 43

List all employees except for IT_PROG job id.


Select one:
a. SELECT *FROM employees WHERE JOB_ID NOT IN ('IT_PROG')
b. All of the choices
c. SELECT *FROM employees WHERE JOB_ID <> 'IT_PROG'
d. SELECT *FROM employees EXCEPT JOB_ID != 'IT_PROG'

Question 44

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 employees WHERE hire_date>=
TO_DATE('Jan-2000', 'Month-YYYY') AND hire_date<= TO_DATE('Dec-2006', 'Month-‘YYYY') AND
salary > 5,000;
b. SELECT last_name, hire_date FROM employees WHERE hire_date>=
TO_DATE('01-Jan-2006', 'DD-Mon-RR') AND hire_date<= TO_DATE('31-Dec-2006', 'DD-Mon-RR') AND
salary > 5000;
c. 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-2006', 'DD-Mon-
YYYY') AND salary ABOVE 5000;
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 45

Display all the records in the employee table. Arrange the output in by lastname from A-Z order.
Select one:
a. SELECT * FROM employees SORT BY lastname ascending
b. SELECT * FROM employees ORDER BY lastname AZ
c. SELECT * FROM employees ORDER BY lastname
d. SELECT * FROM employees SORT BY lastname

Question 46

You want to generate the total salary per month of every department in the company.
Select one:
a. SELECT department_id, SUM(salary) FROM employees GROUP BY department_id
b. SELECT department_id, TOTAL(salary) FROM employees GROUP BY department_id
c. SELECT department_id, salary FROM employees GROUP BY SUM(salary) ORDER BY department_id
d. SELECT department_id, salary FROM employees ORDER BY SUM(salary)

Question 47
Which of the following SELECT statement is the correct PL/SQL that willcreate a report specifying only the
column PRICE, ONHAND and DESCRIPTION?
Select one:
a. SELECTONHAND,PRICE DESCRIPTION FROM PARTS ORDER BY ONHAND;
b. SELECT (ONHAND||PRICE ||DESCRIPTION FROM PARTS;
c. SELECTONHAND,PRICE ,DESCRIPTION FROM PARTS;
d. SELECT PRICE, ONHAND, DESCRIPTION FROM PARTS;

Question 48

TRUE OR FALSE.
The INSERT statement can add multiple rows.
Select one:
True
False

Question 49

Which of the following SELECT statement is the correct report that will rename the column DESCRIPTION to
TITLE, PARTNUM to ID and ONHAND to STOCK?

Select one:
a. SELECT DESCRIPTION NEW AS TITLE, PARTNUM NEW AS ID, ONHAND NEW AS STOCK
FROM PARTS;
b. SELECT DESCRIPTION AS TITLE, PARTNUM AS ID, ONHAND AS STOCK FROM PART;
c. SELECT DESCRIPTION RENAME AS TITLE, PARTNUM RENAME AS ID, ONHAND RENAME
AS STOCK FROM PARTS;
d. SELECT DESCRIPTION AS 'TITLE', PARTNUM AS 'ID', ONHAND AS 'STOCK' FROM PARTS;

Question 50

Evaluate the following SQL command


SELECT employee_id, salary, department_id FROM employees WHERE department_id IN (60,70)
Select one:
a. The SQL command will display employees with department id 60 or 70.
b. The SQL command will produce an error.
c. The SQL command will give an incorrect output.
d. The SQL command will display employees with department id 60 and 70.

Started on Wednesday, 18 December 2019, 10:18 AM

State Finished

Completed on Wednesday, 18 December 2019, 10:28 AM

Time taken 9 mins 11 secs

Grade 10.00 out of 10.00 (100%)

Question 1

Which of the following is CORRECT about sub-queries?


Select one:

a. Execution will depends on the user

b. Subquery execute before the main query executes.

c. Subquery execute after the main query executes

d. Subquery execute in parallel to the main query

Question 2

Which of the folllowing is TRUE?

Select one:

a. PL/SQL statements are embedded within SQL code.

b. SQL code are embedded withing PL/SQL statements

c. You can embed procedural construct within SQL code

d. None of the choices

Question 3

Evaluate the following PL/SQL.

1 DECLARE

2 v_employee_id employees.employee_id%TYPE := 114;

3 BEGIN

4 DELETE employees WHERE employee_id = v_employee_id;

5 END;

Select one:

a. The PL/SQL will delete employee number 114.

b. To execute successfully delete line 1,2,3,5.

c. The PL/SQL will produce an error in line 2.

d. The PL/SQL will produce an error in line 4.

Question 4

You want to display all employee id, name, hired date and salary who are hired after employee 104 was hired.

Select one:

a. SELECT employee_id, last_name, hire_date, salary FROM employees WHERE TO_NUMBER(TO_CHAR(hire_date,


'YYYY')) > (SELECT TO_NUMBER(TO_CHAR(hire_date, 'YYYY')) FROM employees WHERE employee_id = 104)
b. SELECT employee_id, last_name, hire_date, salary FROM employees WHERE TO_CHAR(hire_date, 'YYYY') ANY
(SELECT TO_CHAR(hire_date, 'YYYY') FROM employees WHERE employee_id = 104)

c. SELECT employee_id, last_name, hire_date, salary FROM employees WHERE TO_NUMBER(TO_CHAR(hire_date,


'YYYY')) ALL
(SELECT TO_NUMBER(TO_CHAR(hire_date, 'YYYY')) FROM employees WHERE employee_id = 104)

d. SELECT employee_id, last_name, hire_date, salary FROM employees WHERE TO_NUMBER((hire_date, 'YYYY') IN
(SELECT TO_NUMBER(hire_date, 'YYYY') FROM employees WHERE
employee_id = 104)

Question 5

You have been tasked to update the database by creating a PL/SQL to increase the salary of all IT Programmer
employees by twice of their existing salary. Which of the following will execute successfully?

Select one:

a. DECLARE
v_job_id employees.job_id%TYPE := 'IT_PROG';
v_salary employees.salary := salary;
BEGIN
UPDATE employees SET salary = v_salary * 2 WHERE job_id = v_job_id;
END;

b. DECLARE
v_job_id employees.job_id%TYPE := 'IT_PROG';
BEGIN
UPDATE employees SET salary = salary * 2 WHERE job_id = v_job_id;
END;

c. DECLARE
v_job_id employees.job_id%TYPE := 'IT_PROG';
v_salary employees.salary := salary;
BEGIN
UPDATE employees SET v_salary = salary * 2 WHERE v_job_id = job_id;
END;

d. None of the above

Question 6

Actions are being performed when error occurs during PL/SQL execution in the

Select one:

a. ERROR HANDLING

b. BEGIN section

c. FUNCTION

d. EXCEPTION

Question 7
Which of the folllowing is required in a subquery?

Select one:

a. HAVING BY

b. SELECT

c. GROUP BY

d. ORDER BY

Question 8

In PL/SQL Block Structure, which of the following are OPTIONAL?

Select one:

a. BEGIN and END

b. DECLARE and END

c. None of the choices

d. DECLARE and BEGIN

e. BEGIN and EXCEPTION

f. EXCEPTION and END

Question 9

You want to display all the records of employee the same with the salary employee number 103.

Select one:

a. SELECT * FROM employees WHERE salary = (SELECT salary from employees where employee_id= 103)

b. SELECT salary FROM employees WHERE salary = (SELECT * from employees where employee_id= 103)

c. None of the choices

d. SELECT * FROM employees WHERE employee_id = 103 AND salary = (SELECT salary from employees)

Question 10

Which of the following is INCORRECT?

Select one:

a. Enclose subqueries in parentheses

b. Use multiple-row operators with multiple-row subqueries

c. Place subqueries on the right side of the comparison condition


d. Use single-row operators with multiple-row subqueries

Started on Wednesday, 18 December 2019, 10:28 AM


State Finished
Completed on Wednesday, 18 December 2019, 10:30 AM
Time taken 2 mins 20 secs
Grade 10.00 out of 10.00 (100%)

Question 1

Evaluate the following PL/SQL. Which of the following will line creates an error?

1. CREATE OR REPLACE PROCEDURE query_emp


2. (
3. p_department_id IN employees.department_id%TYPE,
4. p_name OUT employees.last_name%TYPE,
5. p_salary OUT employees.salary%TYPE
6. )
7. IS
8. BEGIN
9. SELECT last_name, salary, department_id INTO p_name, p_salary, p_department_id
10. FROM employees
11. WHERE salary >= p_salary AND department_id = p_department_id ;
12. END query_emp;

Select one:
a. Line 5
b. Line 9
c. Line 11
d. No error
e. Line 3
f. Line 1

Question 2

These are local variables declared in the parameter list of a subprogram specification.
Select one:
a. Actual arguments
b. Passing parameter
c. Formal parameter
d. Actual parameter

Question 3

What is the default parameter mode when no mode is specified?


Select one:
a. IN
b. DEFAULT
c. OUT
d. IN OUT

Question 4

Procedure can be stored in the database as a schema object.


Select one:
True
False

Question 5

Evaluate the following PL/SQL.


DECLARE
v_email VARCHAR(20);
BEGIN
SELECT email INTO v_email FROM EMPLOYEES WHERE email like 'D%';
DBMS_OUTPUT.PUT_LINE ('Employees whose email address starts with letter D :'
|| v_email);
EXCEPTION
WHEN TOO_MANY_ROWS THEN
DBMS_OUTPUT.PUT_LINE (' Your select statement retrieved multiple rows.');
END;
Select one:
a. An error will occur in SQL command.
b. The PL/SQL block will run successfully.
c. An error will occur in EXCEPTION section.
d. An error will occur in declaration section.
e. None of the choices

Question 6

Which of the folllowing does NOT describes subprogram? i. Compiled only once ii. Stored in the database iii.
Do not return values iv. Can take parameters v. Unnamed PL/SQL blocks
Select one:
a. iii & iv
b. ii & v
c. i & iii
d. iii & v

Question 7

Which of the following command is used to create a stand-alone procedure that is stored in the Oracle database?
Select one:
a. DO PROCEDURE
b. CREATE
c. CREATE PROCEDURE
d. PROCEDURE
e. BUILD PROCEDURE

Question 8
Evaluate the following PL/SQL.

1. CREATE OR REPLACE PROCEDURE query_employee


2. (p_id IN employees.employee_id%TYPE,
3. p_name OUT employees.last_name%TYPE,
4. p_salary OUT employees.salary%TYPE) IS
5. BEGIN SELECT last_name, salary INTO p_name, p_salary
6. FROM employeesWHERE employee_id = p_id;
7. END query_employee

Select one:
a. The stored procedure will create an error in line 7
b. The stored procedure will create an error in line 5
c. No error
d. The stored procedure will create an error in line 2 to 4.

Question 9

Which if the following is NOT a benefits of using modular program constructs?


Select one:
a. Improved performance
b. Improved code clarity
c. Easy maintenance
d. None of the choices
e. Improved data security and integrity

Question 10

The PL/SQL code block helps modularize code by using:


Select one:
a. Functions
b. Packages
c. Anonymous blocks
d. All of the choices
e. Database triggers
f. Procedures

Started on Sunday, 29 December 2019, 8:03 PM


State Finished
Completed on Sunday, 29 December 2019, 8:08 PM
Time taken 5 mins 3 secs
Grade 20.00 out of 20.00 (100%)

Question 1

What is the exception name when single row SELECT returned no data.
Select one:
a. NO_RECORDS_FOUND
b. NO_DATA_FOUND
c. END_OF_DATA
d. ZERO_RECORDS_FOUND

Question 2

Complete the diagram in Trapping Non-Predefined Oracle Server Errors.


Select one:
a. Declare, Associate, Reference
b. Declare, Reference, Associate
c. Associate, Declare, Reference
d. Reference, Declare, Associate

Question 3

Actions are being performed when error occurs during PL/SQL execution in the
Select one:
a. BEGIN section
b. FUNCTION
c. ERROR HANDLING
d. EXCEPTION

Question 4

Which of the following DOES NOT describes an exception?


Select one:
a. An exception can be raised implicitly by the Oracle server
b. Exception is a PL/SQL error that is raised before program execution.
c. An exception can be handled by trapping it with a handler
d. None of the choices
e. An exception can be raisedexplicitly by the program

Question 5

How do you test the output of a PL/SQL block?


Select one:
a. Export to a text file
b. Use a predefined Oracle package and its procedure
c. Use the DBMS_OUTPUT("variable name") command
d. Use SELECT command

Question 6

In the DECLARE section of the PL/SQL block,


Select one:
a. You define variables.
b. SQL statements are being executed
c. All of the choices
d. Actions are performed when error occurs

Question 7
What is the error trapping function that returns the numeric value of the error code?
Select one:
a. ERROR_CODE
b. SQL_ERRORCODE
c. ERRORCODE
d. SQLCODE

Question 8

In PL/SQL Block Structure, which of the following are mandatory?


Select one:
a. BEGIN and END
b. DECLARE and END
c. EXCEPTION and END
d. DECLARE and BEGIN
e. BEGIN and EXCEPTION

Question 9

Which of the following does NOT describes SELECT Statement in a PL/SQL.


Select one:
a. The INTO clause is required.
b. Queries must return only one column.
c. INTO clause should be followed by a varible name
d. WHERE clause is required.

Question 10

Which of the folllowing statement describes PL/SQL?


Select one:
a. PL/SQL is an Oracle proprietary, nonprocedural, 3GL programming language
b. PL/SQL is an Oracle proprietary, procedural, unstructured programming language
c. PL/SQL is an Oracle proprietary, procedural, 3GL programming language
d. PL/SQL is an Oracle proprietary.
e. PL/SQL is a ANSI compliant, procedural and structured programming language

Question 11

When an exception is predefined by Oracle server, the exception is raised ____________ .


Select one:
a. Explicitly
b. Exclusively
c. None of the choices
d. Interactively
e. Implicitly

Question 12

RAISE_APPLICATION_ERROR is used in two different places. These are ___________________.


Select one:
a. None of the choices
b. Executable and exceptions section
c. Implicity and explicit section
d. Main and sub section
e. Internal and external section

Question 13

You can use this procedure to issue user-defined error messages from stored subprograms.
Select one:
a. USER_DEFINED_PROC
b. CALL_FUNCTION
c. SUB_ROUTINE
d. RAISE_APPLICATION_ERROR
e. PROCEDURE

Question 14

Which of the following syntax to declare EXCEPTION named e_invalid_id?


Select one:
a. None of the choices
b. e_invalid_id AS EXCEPTION;
c. EXCEPTION e_invalid_id;
d. e_invalid_id EXCEPTION;
e. CREATE e_invalid_id EXCEPTION;

Question 15

When an exception is predefined by Oracle server, the exception is raised ____________ .


Select one:
a. Explicitly
b. Interactively
c. None of the choices
d. Exclusively
e. Implicitly

Question 16

Question text

Which of the folllowing is TRUE?


Select one:
a. None of the choices
b. SQL code are embedded within PL/SQL statements
c. PL/SQL statements are embedded within SQL code.
d. You can embed procedural construct within SQL code

Question 17
You can use this procedure to issue user-defined error messages from stored subprograms.
Select one:
a. CALL_FUNCTION
b. USER_DEFINED_PROC
c. SUB_ROUTINE
d. PROCEDURE
e. RAISE_APPLICATION_ERROR

Question 18

Evaluate the following PL/SQL.

1. DECLARE
2. v_employee_id employees.employee_id%TYPE := 114;
3. BEGIN
4. DELETE employees WHERE employee_id = v_employee_id;
5. END;

Select one:
a. The PL/SQL will produce an error in line 4.
b. The PL/SQL will produce an error in line 2.
c. The PL/SQL will delete employee number 114.
d. To execute successfully delete line 1,2,3,5.

Question 19

Which of the following PL/SQL will execute successfully?


Select one:
a. DECLARE
v_salary INTEGER(20);
BEGIN
SELECT * INTO v_salary FROM employees;
END;
b. DECLARE
v_salary INTEGER(20);
BEGIN
SELECT salary INTO v_salary FROM employees WHERE employee_id = 150;
END;
c. DECLARE
v_salary INTEGER(20);
BEGIN
SELECT salary FROM employees WHERE employee_id = 150;
DBMS_OUTPUT(v_salary);
END;
d. DECLARE
v_salary INTEGER(20);
BEGIN
SELECT salary FROM employees WHERE employee_id = 150;
DBMS_OUTPUT.SCREEN(v_salary);
END;

Question 20

You can trap any error by including a corresponding handler within the exception-handling section of the
PL/SQL block.
Select one:
True
False

Started on Sunday, 29 December 2019, 8:08 PM


State Finished
Completed on Sunday, 29 December 2019, 8:11 PM
Time taken 2 mins 59 secs
Grade 20.00 out of 20.00 (100%)

Question 1

This is a subset of an existing data type that may place a constraint on its base type.
Select one:
a. Subtype
b. Index
c. Data
d. Schema
e. Data dictionary

Question 2

Which of the following rules is INCORRECT about cursor variables?


Select one:
a. You cannot use comparison operators to test cursor variables.
b. Cursors and cursor variables are not interoperable.
c. None of the choices.
d. You cannot assign a null value to cursor variables.
e. You cannot use cursor variables with remote subprograms on another server.
f. You cannot use REF CURSOR types in CREATE TABLE or VIEW statements.

Question 3

Restrictive, specifies a RETURN type, associates only with type-compatible queries are description of a
________________.
Select one:
a. Procedural REF CURSOR
b. Weak REF CURSOR
c. Functional REF CURSOR
d. Strong REF CURSOR
e. Relational REF CURSOR

Question 4

Use column aliases in cursors for calculated columns fetched into records declared with %COLUMNTYPE.
Select one:
True
False

Question 5
Fetch into a record when fetching from a cursor.
Select one:
True
False

Question 6

Which of the following is the syntax to define a REF CURSOR type?


Select one:
a. SET ref_type_name IS REF CURSOR
[RETURN return_type];
b. DEFINE ref_type_name AS REF CURSOR
[RETURN return_type];
c. TYPE ref_type_name IS REF CURSOR
[RETURN return_type];
d. DECLARE ref_type_name AS REF CURSOR
[RETURN return_type];

Question 7

Which of the following is INCORRECT about the guidelines for cursor design?
Select one:
a. Use column aliases in cursors for calculated columns fetched into records declared with
%COLUMNTYPE.
b. None of the choices.
c. Simplify coding with cursor FOR loops.
d. Close a cursor when it is no longer needed.

Question 8

This is a subset of an existing data type that may place a constraint on its base type.
Select one:
a. Data dictionary
b. Index
c. Subtype
d. Schema
e. Data

Question 9

Which of the following rules is INCORRECT about cursor variables?


Select one:
a. None of the choices.
b. You cannot use comparison operators to test cursor variables.
c. You cannot use cursor variables with remote subprograms on another server.
d. Cursors and cursor variables are not interoperable.
e. You cannot use REF CURSOR types in CREATE TABLE or VIEW statements.
f. You cannot assign a null value to cursor variables.

Question 10
Which of the following is the syntax to close a cursor?
Select one:
a. CLOSE cursor_variable_name;
b. EXIT cursor_variable_name;
c. QUIT cursor_variable_name;
d. SET cursor_variable_nameCLOSE;

Question 11

Which of the following is the syntax to open a cursor varial


Select one:
a. LOAD cursor_variable_name
FOR select_statement;
b. GET cursor_variable_name
FOR select_statement;
c. SET cursor_variable_name
FOR select_statement;
d. OPEN cursor_variable_name
FOR select_statement;

Question 12

Weak REF CURSOR is very flexible.


Select one:
True
False

Question 13

Evaluate the following. What will be the output?

1. DECLARE
2. SUBTYPE Accumulator IS NUMBER (4,2);
3. v_amount accumulator;
4. v_num1 NUMBER;
5. v_num2 NUMBER;
6. v_num3 NUMBER;
7. BEGIN
8. v_amount := 10.50;
9. v_num1 := 1;
10. v_num2 := 2;
11. v_num3 := 3;
12. v_num1 := v_amount;
13. v_num2 := v_num1 + v_amount;
14. v_num2 := v_num2 - v_num3;
15.
16. dbms_output.put_line('Total is: ' || v_num2);
17.
18. END;

Select one:
a. 8.5
b. 18
c. None of the choices
d. -1
Question 14

Which of the following describes weak REF CURSOR?


Select one:
a. All of the choices
b. Restrictive
c. Associates with any query
d. Is not flexible

Question 15

Which of the following is the syntax to fetch from a cursor variable?


Select one:
a. GET cursor_variable_name INTO variable_name1
[,variable_name2,. . .] | record_name;
b. FETCH cursor_variable_name INTO variable_name1
[,variable_name2,. . .] | record_name;
c. POST cursor_variable_name INTO variable_name1
[,variable_name2,. . .] | record_name;
d. RETRIEVE cursor_variable_name INTO variable_name1
[,variable_name2,. . .] | record_name;

Started on Sunday, 29 December 2019, 8:12 PM

State Finished

Completed on Sunday, 29 December 2019, 8:42 PM

Time taken 29 mins 46 secs

Grade 48.00 out of 50.00 (96%)

Question 1

Which of the following is INCORRECT about the guidelines for cursor design?

Select one:

a. None of the choices.

b. Use column aliases in cursors for calculated columns fetched into records declared with %COLUMNTYPE.

c. Simplify coding with cursor FOR loops.

d. Close a cursor when it is no longer needed.

Question 2

What is the last clause in trapping exceptions?

Select one:

a. CONFIRM
b. OTHERWISE

c. THEN

d. WHEN OTHERS

Question 3

Evaluate the following PL/SQL.

1. DECLARE
2. v_employee_id employees.employee_id%TYPE := 114;
3. BEGIN
4. DELETE employees WHERE employee_id = v_employee_id;
5. END;

Select one:

a. The PL/SQL will produce an error in line 4.

b. The PL/SQL will delete employee number 114.

c. To execute successfully delete line 1,2,3,5.

d. The PL/SQL will produce an error in line 2.

Question 4

Which of the following is the syntax to define a REF CURSOR type?

Select one:

a. SET ref_type_name IS REF CURSOR


[RETURN return_type];

b. TYPE ref_type_name IS REF CURSOR


[RETURN return_type];

c. DEFINE ref_type_name AS REF CURSOR


[RETURN return_type];

d. DECLARE ref_type_name AS REF CURSOR


[RETURN return_type];

Question 5

Restrictive, specifies a RETURN type, associates only with type-compatible queries are description of a
________________.

Select one:

a. Strong REF CURSOR

b. Functional REF CURSOR


c. Relational REF CURSOR

d. Weak REF CURSOR

e. Procedural REF CURSOR

Question 6

Which of the following rules is INCORRECT about cursor variables?

Select one:

a. You cannot use cursor variables with remote subprograms on another server.

b. None of the choices.

c. You cannot assign a null value to cursor variables.

d. You cannot use REF CURSOR types in CREATE TABLE or VIEW statements.

e. You cannot use comparison operators to test cursor variables.

f. Cursors and cursor variables are not interoperable.

Question 7

The PL/SQL code block helps modularize code by using:

Select one:

a. Procedures

b. Database triggers

c. Functions

d. Packages

e. All of the choices

f. Anonymous blocks

Question 8

Weak REF CURSOR is very flexible.

Select one:

True

False

Question 9
Matt wants to change his password from 1234 to abcd.
Which of the following will perform the task?

Select one:

a. CHANGE USER matt PASSWORD abcd

b. UPDATE matt WITH abcd

c. ALTER USER matt IDENTIFIED abcd;

d. User matt cannot change his password. DBA has only the rights to change the password

e. UPDATE PASSWORD 1234 TO abcd FROM matt

Question 10

What is the last clause in trapping exceptions?

Select one:

a. THEN

b. CONFIRM

c. OTHERWISE

d. WHEN OTHERS

Question 11

What are the three PL/SQL block types?

Select one:

a. Add, Edit, Delete

b. Anonymous, Procedure, Function

c. SELECT, UPDATE, INSERT

d. DECLARE, BEGIN, END

Question 12

In the DECLARE section of the PL/SQL block,

Select one:

a. SQL statements are being executed

b. You define variables.

c. Actions are performed when error occurs


d. All of the choices

Question 13

Which of the following rules is INCORRECT about cursor variables?

Select one:

a. You cannot use cursor variables with remote subprograms on another server.

b. None of the choices.

c. You cannot use REF CURSOR types in CREATE TABLE or VIEW statements.

d. You cannot assign a null value to cursor variables.

e. Cursors and cursor variables are not interoperable.

f. You cannot use comparison operators to test cursor variables.

Question 14

Use column aliases in cursors for calculated columns fetched into records declared with %COLUMNTYPE.

Select one:

True

False

Question 15

You have been tasked to update the database by creating a PL/SQL to increase the salary of all IT Programmer
employees by 50% of their existing salary.

Which of the following will execute successfully?

Select one:

a. DECLARE
v_job_id employees.job_id%TYPE := 'IT_PROG';
BEGIN
UPDATE employees SET salary = salary *0.50 WHERE job_id = v_job_id;
END;

b. DECLARE
v_job_id employees.job_id%TYPE := 'IT_PROG';
BEGIN
UPDATE employees SET salary = salary * 50% WHERE job_id = v_job_id;
END;

c. DECLARE
v_job_id employees.job_id%TYPE := 'IT_PROG';
v_salary employees.salary := salary;
BEGIN
UPDATE employees SET salary = v_salary * 0.50% WHERE job_id = v_job_id;
END;

d. DECLARE
v_job_id employees.job_id%TYPE := 'IT_PROG';
v_salary employees.salary := salary;
BEGIN
UPDATE employees SET v_salary = salary * 0.50 WHERE v_job_id = job_id;
END;

Question 16

Which if the following is NOT a benefits of using modular program constructs?

Select one:

a. None of the choices

b. Improved code clarity

c. Improved performance

d. Easy maintenance

e. Improved data security and integrity

Question 17

You have been tasked to update the database by creating a PL/SQL to increase the salary of all IT Programmer
employees by 100% of their existing salary. Which of the following will execute successfully?

Select one:

a. DECLARE
v_job_id employees.job_id%TYPE := 'IT_PROG';
BEGIN
UPDATE employees SET salary = salary * 2 WHERE job_id = v_job_id;
END;

b. DECLARE
v_job_id employees.job_id%TYPE := 'IT_PROG';
BEGIN
UPDATE employees SET salary = salary * 100% WHERE job_id = v_job_id;
END;

c. DECLARE
v_job_id employees.job_id%TYPE := 'IT_PROG';
v_salary employees.salary := salary;
BEGIN
UPDATE employees SET v_salary = salary * 1.00 WHERE v_job_id = job_id;
END;

d. DECLARE
v_job_id employees.job_id%TYPE := 'IT_PROG';
v_salary employees.salary := salary;
BEGIN
UPDATE employees SET salary = v_salary * 0.100% WHERE job_id = v_job_id;
END;

Question 18

Which of the following will erase all records in the departments table

Select one:

a. DELETE * FROM departments

b. TRUNCATE TABLE departments

c. DELETE FROM departments

d. TRUNCATE FROM TABLE departments

Question 19

A Cartesian product is formed when:

Select one:

a. All of the choices

b. All rows in the first table are joined to all rows in the second table

c. A join condition is invalid

d. A join condition is omitted

Question 20

You want to display all employee id, name, hired date and salary who are hired after employee 104 was hired.

Select one:

a. SELECT employee_id, last_name, hire_date, salary FROM employees WHERE TO_NUMBER(TO_CHAR(hire_date,


'YYYY')) > (SELECT TO_NUMBER(TO_CHAR(hire_date, 'YYYY')) FROM employees WHERE employee_id = 104)

b. SELECT employee_id, last_name, hire_date, salary FROM employees WHERE TO_NUMBER((hire_date, 'YYYY') IN
(SELECT TO_NUMBER(hire_date, 'YYYY') FROM employees WHERE
employee_id = 104)

c. SELECT employee_id, last_name, hire_date, salary FROM employees WHERE TO_NUMBER(TO_CHAR(hire_date,


'YYYY')) ALL
(SELECT TO_NUMBER(TO_CHAR(hire_date, 'YYYY')) FROM employees WHERE employee_id = 104)

d. SELECT employee_id, last_name, hire_date, salary FROM employees WHERE TO_CHAR(hire_date, 'YYYY') ANY
(SELECT TO_CHAR(hire_date, 'YYYY') FROM employees WHERE employee_id = 104)

Question 21

Which of the following PL/SQL that will display the total number employees whose salary is 10000 and above?
Select one:

a. DECLARE
v_salary employees.salary%TYPE := 10000;
BEGIN
SELECT COUNT(*) INTO v_salary FROM employees WHERE salary >= v_salary;
DBMS_OUTPUT.PUT_LINE(v_salary);
END;

b. None of the Choices

c. DECLARE
v_salary employees.salary%TYPE :>= 10000;
BEGIN
SELECT COUNT(salary) INTO v_salary FROM employees WHERE salary >= v_salary;
DBMS_OUTPUT.PUT_LINE(‘Total:’ || v_salary);
END;

d. DECLARE
v_salary TYPE%NUMERIC >= 10000;
BEGIN
SELECT COUNT(salary) INTO v_salary FROM employees WHERE salary >= v_salary;
DBMS_OUTPUT.PUT_LINE(‘Total:’ || v_salary);
END;

Question 22

Nathaniel had accidentally deleted all the records in the newly updated ORACLE database using the DELETE SQL
command.
What is the best solution that he can do to restore all the deleted records in the database.

Select one:

a. Restore the backup copy

b. None of the choices

c. Re-encode the data

d. Run the ROLLBACK command

e. Execute the UNDELETE command

Question 23

Fetch into a record when fetching from a cursor.

Select one:

True

False

Question 24
In PL/SQL Block Structure, which of the following are OPTIONAL?

Select one:

a. BEGIN and EXCEPTION

b. None of the choices

c. DECLARE and BEGIN

d. EXCEPTION and END

e. BEGIN and END

f. DECLARE and END

Question 25

Which of the following DOES NOT describes the state of the data after the COMMIT command

Select one:

a. The previous state of the data is overwritten.

b. None of the choices

c. All savepoints are erased.

d. Locks on the affected rows are released; those rows are available for other users to manipulate.

e. Data changes are saved in the database.

f. All users can view the results.

Question 26

Evaluate the folllowing PL/SQL

1. DECLARE

2. v_job_id employees.job_id%TYPE := 'IT_PROG';

3. v_last_name employees.last_name%TYPE := 'Lim';

4. v_first_name employees.first_name%TYPE := 'Steven';

5. BEGIN

6. INSERT INTO employees (employee_id, last_name, first_name, email, hire_date, job_id, salary)

7. VALUES (employees_seq.NEXTVAL, v_last_name, v_first_name,


v_last_name||v_first_name||'@gmail.com', CURRENT_DATE, v_job_id, 63000);

8. END;

Select one:
a. Error in Line 7. Due to invalid variables.

b. No Error.

c. Error in variable declaration

d. Error in Line 7. Invalid due to syntax in concatenation.

e. Error in Line 6. All fieldnames should be included.

Question 27

PL/SQL Provides a block structure for executable units of ________________.

Select one:

a. Code

b. Information

c. Data

d. Table

Question 28

Evaluate the following SQL command


SELECT employee_id, hire_date, department_name FROM employees, departments
WHERE departments.department_id = employees.department_id

Select one:

a. The SQL command will give an incorrect output.

b. The SQL command should have ALIAS for the table to produce a correct output.

c. The SQL command will produce a correct output.

d. The SQL command will produce an error.

Question 29

These are local variables declared in the parameter list of a subprogram specification.

Select one:

a. Actual arguments

b. Formal parameter

c. Actual parameter

d. Passing parameter
Question 30

Which of the following does NOT describes SELECT Statement in a PL/SQL.

Select one:

a. Queries must return only one column.

b. The INTO clause is required.

c. WHERE clause is required.

d. INTO clause should be followed by a varible name

Question 31

What is the exception name when PL/SQL has an internal problem

Select one:

a. EXECUTION_ERROR

b. ERROR_MSG

c. RUNTIME_ERROR

d. PROGRAM_ERROR

Question 32

What is the default parameter mode when no mode is specified?

Select one:

a. IN OUT

b. OUT

c. IN

d. DEFAULT

Question 33

Which of the following command is used to create a stand-alone procedure that is stored in the Oracle database?

Select one:

a. PROCEDURE

b. DO PROCEDURE

c. CREATE PROCEDURE

d. CREATE
e. BUILD PROCEDURE

Question 34

You can use this procedure to issue user-defined error messages from stored subprograms.

Select one:

a. SUB_ROUTINE

b. CALL_FUNCTION

c. USER_DEFINED_PROC

d. RAISE_APPLICATION_ERROR

e. PROCEDURE

Question 35

When an exception is predefined by Oracle server, the exception is raised ____________ .

Select one:

a. Implicitly

b. Interactively

c. Exclusively

d. Explicitly

e. None of the choices

Question 36

Evaluate the following PL/SQL. Which of the following will line creates an error?

1. CREATE OR REPLACE PROCEDURE query_emp


2. (
3. p_department_id IN employees.department_id%TYPE,
4. p_name OUT employees.last_name%TYPE,
5. p_salary OUT employees.salary%TYPE
6. )
7. IS
8. BEGIN
9. SELECT last_name, salary, department_id INTO p_name, p_salary, p_department_id
10. FROM employees
11. WHERE salary >= p_salary AND department_id = p_department_id ;
12. END query_emp;

Select one:

a. Line 5
b. Line 9

c. No error

d. Line 3

e. Line 1

f. Line 11

Question 37

SQL command to create a marker in the current transaction.

Select one:

a. POINTER

b. SAVEMARKER

c. INDEX

d. SAVEPOINT

e. SAVEMORE

Question 38

Procedure can be stored in the database as a schema object.

Select one:

True

False

Question 39

Evaluate the following PL/SQL.

1. CREATE OR REPLACE PROCEDURE query_employee


2. (p_id IN employees.employee_id%TYPE,
3. p_name OUT employees.last_name%TYPE,
4. p_salary OUT employees.salary%TYPE) IS
5. BEGIN SELECT last_name, salary INTO p_name, p_salary
6. FROM employeesWHERE employee_id = p_id;
7. END query_employee

Select one:

a. The stored procedure will create an error in line 5

b. No error
c. The stored procedure will create an error in line 2 to 4.

d. The stored procedure will create an error in line 7

Question 40

Which of the following is the syntax to open a cursor varial

Select one:

a. OPEN cursor_variable_name
FOR select_statement;

b. GET cursor_variable_name
FOR select_statement;

c. SET cursor_variable_name
FOR select_statement;

d. LOAD cursor_variable_name
FOR select_statement;

Question 41

Which of the folllowing does NOT describes subprogram? i. Compiled only once ii. Stored in the database iii. Do not
return values iv. Can take parameters v. Unnamed PL/SQL blocks

Select one:

a. iii & v

b. i & iii

c. ii & v

d. iii & iv

Question 42

You want to cancel the privilege of matt to add records from the employees table.

Select one:

a. REVOKE insert ON employees FROM matt;

b. REVOKE insert ON matt FROM employees;

c. REVOKE matt FROM employees TO insert;

d. REVOKE employees FROM matt TO insert;

Question 43

Evaluate the given SQL syntax


INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...)
WHERE condition;

Select one:

a. Correct syntax.

b. This will produce an error.

c. INSERT should be UPDATE command

d. Wrong placement of WHERE and VALUES

Question 44

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'

Select one:

a. This will return an error. "ANY" can not be compared to salary

b. This will return an error. Parenthesis in the subquery should be removed.

c. This will return an error. Employees table can not be used in the subquery if it used in the main query.

d. This has no error.

Question 45

This is a subset of an existing data type that may place a constraint on its base type.

Select one:

a. Subtype

b. Data dictionary

c. Schema

d. Index

e. Data

Question 46

This is a subset of an existing data type that may place a constraint on its base type.

Select one:

a. Schema

b. Data dictionary
c. Subtype

d. Data

e. Index

Question 47

PL/SQL Provides a block structure for executable units of ________________.

Select one:

a. Information

b. Data

c. Code

d. Table

Question 48

Given the DEPARTMENTS table and USER user1, evaluate the SQL command:

GRANT select

ON user1

TO departments;

Select one:

a. The following will grant query privileges on the DEPARTMENTS table:

b. The folllowing will grant object privileges on USER user1

c. The SQL command is incorrect

d. None of the choices

Question 49

Evaluate the SQL command


SELECT employee_id, job_id, salary from employees where salary < ALL (SELECT salary FROM employees WHERE job_id =
'FI_ACCOUNT') AND job_id = 'IT_PROG'

Select one:

a. This will return an error. No data will be displayed.

b. This will return an error. Job_id FI_ACCOUNT and IT_PROG conflicts.

c. This will return an error. Invalid parameter "ALL".

d. This has no error.


Question 50

In the DECLARE section of the PL/SQL block

Select one:

a. Actions are performed when error occurs

b. All of the choices

c. SQL statements are being executed

d. You define variables.

Started on Wednesday, 18 December 2019, 10:18 AM

State Finished

Completed on Wednesday, 18 December 2019, 10:28 AM

Time taken 9 mins 11 secs

Grade 10.00 out of 10.00 (100%)

Question 1

Which of the following is CORRECT about sub-queries?

Select one:

b. Subquery execute before the main query executes.

Question 2

Which of the folllowing is TRUE?

Select one:

b. SQL code are embedded withing PL/SQL statements

Question 3

Evaluate the following PL/SQL.

1 DECLARE

2 v_employee_id employees.employee_id%TYPE := 114;

3 BEGIN

4 DELETE employees WHERE employee_id = v_employee_id;

5 END;

Select one:
a. The PL/SQL will delete employee number 114.

Question 4

You want to display all employee id, name, hired date and salary who are hired after employee 104 was hired.

Select one:

a. SELECT employee_id, last_name, hire_date, salary FROM employees WHERE TO_NUMBER(TO_CHAR(hire_date,


'YYYY')) > (SELECT TO_NUMBER(TO_CHAR(hire_date, 'YYYY')) FROM employees WHERE employee_id = 104)

Question 5

You have been tasked to update the database by creating a PL/SQL to increase the salary of all IT Programmer
employees by twice of their existing salary. Which of the following will execute successfully?

Select one:

b. DECLARE
v_job_id employees.job_id%TYPE := 'IT_PROG';
BEGIN
UPDATE employees SET salary = salary * 2 WHERE job_id = v_job_id;
END;

Question 6

Actions are being performed when error occurs during PL/SQL execution in the

Select one:

d. EXCEPTION

Question 7

Which of the folllowing is required in a subquery?

Select one:

b. SELECT

Question 8

In PL/SQL Block Structure, which of the following are OPTIONAL?

Select one:

c. None of the choices

Question 9

You want to display all the records of employee the same with the salary employee number 103.

Select one:

a. SELECT * FROM employees WHERE salary = (SELECT salary from employees where employee_id= 103)

Question 10
Which of the following is INCORRECT?

Select one:

d. Use single-row operators with multiple-row subqueries

Started on Wednesday, 18 December 2019, 10:28 AM

State Finished

Completed on Wednesday, 18 December 2019, 10:30 AM

Time taken 2 mins 20 secs

Grade 10.00 out of 10.00 (100%)

Question 1

Evaluate the following PL/SQL. Which of the following will line creates an error?

1. CREATE OR REPLACE PROCEDURE query_emp


2. (
3. p_department_id IN employees.department_id%TYPE,
4. p_name OUT employees.last_name%TYPE,
5. p_salary OUT employees.salary%TYPE
6. )
7. IS
8. BEGIN
9. SELECT last_name, salary, department_id INTO p_name, p_salary, p_department_id
10. FROM employees
11. WHERE salary >= p_salary AND department_id = p_department_id ;
12. END query_emp;

Select one:

a. Line 5

b. Line 9

c. Line 11

d. No error

e. Line 3

f. Line 1

Question 2

These are local variables declared in the parameter list of a subprogram specification.

Select one:

a. Actual arguments
b. Passing parameter

c. Formal parameter

d. Actual parameter

Question 3

What is the default parameter mode when no mode is specified?

Select one:

a. IN

b. DEFAULT

c. OUT

d. IN OUT

Question 4

Procedure can be stored in the database as a schema object.

Select one:

True

False

Question 5

Evaluate the following PL/SQL.


DECLARE
v_email VARCHAR(20);
BEGIN
SELECT email INTO v_email FROM EMPLOYEES WHERE email like 'D%';
DBMS_OUTPUT.PUT_LINE ('Employees whose email address starts with letter D :'
|| v_email);
EXCEPTION
WHEN TOO_MANY_ROWS THEN
DBMS_OUTPUT.PUT_LINE (' Your select statement retrieved multiple rows.');
END;

Select one:

a. An error will occur in SQL command.

b. The PL/SQL block will run successfully.

c. An error will occur in EXCEPTION section.

d. An error will occur in declaration section.

e. None of the choices


Question 6

Which of the folllowing does NOT describes subprogram? i. Compiled only once ii. Stored in the database iii. Do not
return values iv. Can take parameters v. Unnamed PL/SQL blocks

Select one:

a. iii & iv

b. ii & v

c. i & iii

d. iii & v

Question 7

Which of the following command is used to create a stand-alone procedure that is stored in the Oracle database?

Select one:

a. DO PROCEDURE

b. CREATE

c. CREATE PROCEDURE

d. PROCEDURE

e. BUILD PROCEDURE

Question 8

Evaluate the following PL/SQL.

1. CREATE OR REPLACE PROCEDURE query_employee


2. (p_id IN employees.employee_id%TYPE,
3. p_name OUT employees.last_name%TYPE,
4. p_salary OUT employees.salary%TYPE) IS
5. BEGIN SELECT last_name, salary INTO p_name, p_salary
6. FROM employeesWHERE employee_id = p_id;
7. END query_employee

Select one:

a. The stored procedure will create an error in line 7

b. The stored procedure will create an error in line 5

c. No error

d. The stored procedure will create an error in line 2 to 4.

Question 9
Which if the following is NOT a benefits of using modular program constructs?

Select one:

a. Improved performance

b. Improved code clarity

c. Easy maintenance

d. None of the choices

e. Improved data security and integrity

Question 10

The PL/SQL code block helps modularize code by using:

Select one:

a. Functions

b. Packages

c. Anonymous blocks

d. All of the choices

e. Database triggers

f. Procedures

Started on Sunday, 29 December 2019, 8:03 PM

State Finished

Completed on Sunday, 29 December 2019, 8:08 PM

Time taken 5 mins 3 secs

Grade 20.00 out of 20.00 (100%)

Question 1

What is the exception name when single row SELECT returned no data.

Select one:

a. NO_RECORDS_FOUND

b. NO_DATA_FOUND

c. END_OF_DATA
d. ZERO_RECORDS_FOUND

Question 2

Complete the diagram in Trapping Non-Predefined Oracle Server Errors.

Select one:

a. Declare, Associate, Reference

b. Declare, Reference, Associate

c. Associate, Declare, Reference

d. Reference, Declare, Associate

Question 3

Actions are being performed when error occurs during PL/SQL execution in the

Select one:

a. BEGIN section

b. FUNCTION

c. ERROR HANDLING

d. EXCEPTION

Question 4

Which of the following DOES NOT describes an exception?

Select one:

a. An exception can be raised implicitly by the Oracle server

b. Exception is a PL/SQL error that is raised before program execution.

c. An exception can be handled by trapping it with a handler

d. None of the choices

e. An exception can be raisedexplicitly by the program

Question 5

How do you test the output of a PL/SQL block?

Select one:

a. Export to a text file

b. Use a predefined Oracle package and its procedure


c. Use the DBMS_OUTPUT("variable name") command

d. Use SELECT command

Question 6

In the DECLARE section of the PL/SQL block,

Select one:

a. You define variables.

b. SQL statements are being executed

c. All of the choices

d. Actions are performed when error occurs

Question 7

What is the error trapping function that returns the numeric value of the error code?

Select one:

a. ERROR_CODE

b. SQL_ERRORCODE

c. ERRORCODE

d. SQLCODE

Question 8

In PL/SQL Block Structure, which of the following are mandatory?

Select one:

a. BEGIN and END

b. DECLARE and END

c. EXCEPTION and END

d. DECLARE and BEGIN

e. BEGIN and EXCEPTION

Question 9

Which of the following does NOT describes SELECT Statement in a PL/SQL.

Select one:

a. The INTO clause is required.


b. Queries must return only one column.

c. INTO clause should be followed by a varible name

d. WHERE clause is required.

Question 10

Which of the folllowing statement describes PL/SQL?

Select one:

a. PL/SQL is an Oracle proprietary, nonprocedural, 3GL programming language

b. PL/SQL is an Oracle proprietary, procedural, unstructured programming language

c. PL/SQL is an Oracle proprietary, procedural, 3GL programming language

d. PL/SQL is an Oracle proprietary.

e. PL/SQL is a ANSI compliant, procedural and structured programming language

Question 11

When an exception is predefined by Oracle server, the exception is raised ____________ .

Select one:

a. Explicitly

b. Exclusively

c. None of the choices

d. Interactively

e. Implicitly

Question 12

RAISE_APPLICATION_ERROR is used in two different places. These are ___________________.

Select one:

a. None of the choices

b. Executable and exceptions section

c. Implicity and explicit section

d. Main and sub section

e. Internal and external section


Question 13

You can use this procedure to issue user-defined error messages from stored subprograms.

Select one:

a. USER_DEFINED_PROC

b. CALL_FUNCTION

c. SUB_ROUTINE

d. RAISE_APPLICATION_ERROR

e. PROCEDURE

Question 14

Which of the following syntax to declare EXCEPTION named e_invalid_id?

Select one:

a. None of the choices

b. e_invalid_id AS EXCEPTION;

c. EXCEPTION e_invalid_id;

d. e_invalid_id EXCEPTION;

e. CREATE e_invalid_id EXCEPTION;

Question 15

When an exception is predefined by Oracle server, the exception is raised ____________ .

Select one:

a. Explicitly

b. Interactively

c. None of the choices

d. Exclusively

e. Implicitly

Question 16

Which of the folllowing is TRUE?

Select one:

a. None of the choices


b. SQL code are embedded within PL/SQL statements

c. PL/SQL statements are embedded within SQL code.

d. You can embed procedural construct within SQL code

Question 17

You can use this procedure to issue user-defined error messages from stored subprograms.

Select one:

a. CALL_FUNCTION

b. USER_DEFINED_PROC

c. SUB_ROUTINE

d. PROCEDURE

e. RAISE_APPLICATION_ERROR

Question 18

Evaluate the following PL/SQL.

1. DECLARE
2. v_employee_id employees.employee_id%TYPE := 114;
3. BEGIN
4. DELETE employees WHERE employee_id = v_employee_id;
5. END;

Select one:

a. The PL/SQL will produce an error in line 4.

b. The PL/SQL will produce an error in line 2.

c. The PL/SQL will delete employee number 114.

d. To execute successfully delete line 1,2,3,5.

Question 19

Which of the following PL/SQL will execute successfully?

Select one:

a. DECLARE
v_salary INTEGER(20);
BEGIN
SELECT * INTO v_salary FROM employees;
END;
b. DECLARE
v_salary INTEGER(20);
BEGIN
SELECT salary INTO v_salary FROM employees WHERE employee_id = 150;
END;

c. DECLARE
v_salary INTEGER(20);
BEGIN
SELECT salary FROM employees WHERE employee_id = 150;
DBMS_OUTPUT(v_salary);
END;

d. DECLARE
v_salary INTEGER(20);
BEGIN
SELECT salary FROM employees WHERE employee_id = 150;
DBMS_OUTPUT.SCREEN(v_salary);
END;

Question 20

You can trap any error by including a corresponding handler within the exception-handling section of the PL/SQL block.

Select one:

True

False

Started on Sunday, 29 December 2019, 8:08 PM

State Finished

Completed on Sunday, 29 December 2019, 8:11 PM

Time taken 2 mins 59 secs

Grade 20.00 out of 20.00 (100%)

Question 1

This is a subset of an existing data type that may place a constraint on its base type.

Select one:

a. Subtype

b. Index

c. Data

d. Schema
e. Data dictionary

Question 2

Which of the following rules is INCORRECT about cursor variables?

Select one:

a. You cannot use comparison operators to test cursor variables.

b. Cursors and cursor variables are not interoperable.

c. None of the choices.

d. You cannot assign a null value to cursor variables.

e. You cannot use cursor variables with remote subprograms on another server.

f. You cannot use REF CURSOR types in CREATE TABLE or VIEW statements.

Question 3

Restrictive, specifies a RETURN type, associates only with type-compatible queries are description of a
________________.

Select one:

a. Procedural REF CURSOR

b. Weak REF CURSOR

c. Functional REF CURSOR

d. Strong REF CURSOR

e. Relational REF CURSOR

Question 4

Use column aliases in cursors for calculated columns fetched into records declared with %COLUMNTYPE.

Select one:

True

False

Question 5

Fetch into a record when fetching from a cursor.

Select one:

True
False

Question 6

Which of the following is the syntax to define a REF CURSOR type?

Select one:

a. SET ref_type_name IS REF CURSOR


[RETURN return_type];

b. DEFINE ref_type_name AS REF CURSOR


[RETURN return_type];

c. TYPE ref_type_name IS REF CURSOR


[RETURN return_type];

d. DECLARE ref_type_name AS REF CURSOR


[RETURN return_type];

Question 7

Which of the following is INCORRECT about the guidelines for cursor design?

Select one:

a. Use column aliases in cursors for calculated columns fetched into records declared with %COLUMNTYPE.

b. None of the choices.

c. Simplify coding with cursor FOR loops.

d. Close a cursor when it is no longer needed.

Question 8

This is a subset of an existing data type that may place a constraint on its base type.

Select one:

a. Data dictionary

b. Index

c. Subtype

d. Schema

e. Data

Question 9

Which of the following rules is INCORRECT about cursor variables?

Select one:
a. None of the choices.

b. You cannot use comparison operators to test cursor variables.

c. You cannot use cursor variables with remote subprograms on another server.

d. Cursors and cursor variables are not interoperable.

e. You cannot use REF CURSOR types in CREATE TABLE or VIEW statements.

f. You cannot assign a null value to cursor variables.

Question 10

Which of the following is the syntax to close a cursor?

Select one:

a. CLOSE cursor_variable_name;

b. EXIT cursor_variable_name;

c. QUIT cursor_variable_name;

d. SET cursor_variable_nameCLOSE;

Question 11

Which of the following is the syntax to open a cursor varial

Select one:

a. LOAD cursor_variable_name
FOR select_statement;

b. GET cursor_variable_name
FOR select_statement;

c. SET cursor_variable_name
FOR select_statement;

d. OPEN cursor_variable_name
FOR select_statement;

Question 12

Weak REF CURSOR is very flexible.

Select one:

True

False

Question 13
Evaluate the following. What will be the output?

1. DECLARE
2. SUBTYPE Accumulator IS NUMBER (4,2);
3. v_amount accumulator;
4. v_num1 NUMBER;
5. v_num2 NUMBER;
6. v_num3 NUMBER;
7. BEGIN
8. v_amount := 10.50;
9. v_num1 := 1;
10. v_num2 := 2;
11. v_num3 := 3;
12. v_num1 := v_amount;
13. v_num2 := v_num1 + v_amount;
14. v_num2 := v_num2 - v_num3;
15.
16. dbms_output.put_line('Total is: ' || v_num2);
17.
18. END;

Select one:

a. 8.5

b. 18

c. None of the choices

d. -1

Question 14

Which of the following describes weak REF CURSOR?

Select one:

a. All of the choices

b. Restrictive

c. Associates with any query

d. Is not flexible

Question 15

Which of the following is the syntax to fetch from a cursor variable?

Select one:

a. GET cursor_variable_name INTO variable_name1


[,variable_name2,. . .] | record_name;

b. FETCH cursor_variable_name INTO variable_name1


[,variable_name2,. . .] | record_name;
c. POST cursor_variable_name INTO variable_name1
[,variable_name2,. . .] | record_name;

d. RETRIEVE cursor_variable_name INTO variable_name1


[,variable_name2,. . .] | record_name;

Started on Sunday, 29 December 2019, 8:12 PM

State Finished

Completed on Sunday, 29 December 2019, 8:42 PM

Time taken 29 mins 46 secs

Grade 48.00 out of 50.00 (96%)

Question 1

Which of the following is INCORRECT about the guidelines for cursor design?

Select one:

a. None of the choices.

b. Use column aliases in cursors for calculated columns fetched into records declared with %COLUMNTYPE.

c. Simplify coding with cursor FOR loops.

d. Close a cursor when it is no longer needed.

Question 2

What is the last clause in trapping exceptions?

Select one:

a. CONFIRM

b. OTHERWISE

c. THEN

d. WHEN OTHERS

Question 3

Evaluate the following PL/SQL.

1. DECLARE
2. v_employee_id employees.employee_id%TYPE := 114;
3. BEGIN
4. DELETE employees WHERE employee_id = v_employee_id;
5. END;
Select one:

a. The PL/SQL will produce an error in line 4.

b. The PL/SQL will delete employee number 114.

c. To execute successfully delete line 1,2,3,5.

d. The PL/SQL will produce an error in line 2.

Question 4

Which of the following is the syntax to define a REF CURSOR type?

Select one:

a. SET ref_type_name IS REF CURSOR


[RETURN return_type];

b. TYPE ref_type_name IS REF CURSOR


[RETURN return_type];

c. DEFINE ref_type_name AS REF CURSOR


[RETURN return_type];

d. DECLARE ref_type_name AS REF CURSOR


[RETURN return_type];

Question 5

Restrictive, specifies a RETURN type, associates only with type-compatible queries are description of a
________________.

Select one:

a. Strong REF CURSOR

b. Functional REF CURSOR

c. Relational REF CURSOR

d. Weak REF CURSOR

e. Procedural REF CURSOR

Question 6

Which of the following rules is INCORRECT about cursor variables?

Select one:

a. You cannot use cursor variables with remote subprograms on another server.

b. None of the choices.


c. You cannot assign a null value to cursor variables.

d. You cannot use REF CURSOR types in CREATE TABLE or VIEW statements.

e. You cannot use comparison operators to test cursor variables.

f. Cursors and cursor variables are not interoperable.

Question 7

The PL/SQL code block helps modularize code by using:

Select one:

a. Procedures

b. Database triggers

c. Functions

d. Packages

e. All of the choices

f. Anonymous blocks

Question 8

Weak REF CURSOR is very flexible.

Select one:

True

False

Question 9

Matt wants to change his password from 1234 to abcd.


Which of the following will perform the task?

Select one:

a. CHANGE USER matt PASSWORD abcd

b. UPDATE matt WITH abcd

c. ALTER USER matt IDENTIFIED abcd;

d. User matt cannot change his password. DBA has only the rights to change the password

e. UPDATE PASSWORD 1234 TO abcd FROM matt

Question 10
What is the last clause in trapping exceptions?

Select one:

a. THEN

b. CONFIRM

c. OTHERWISE

d. WHEN OTHERS

Question 11

What are the three PL/SQL block types?

Select one:

a. Add, Edit, Delete

b. Anonymous, Procedure, Function

c. SELECT, UPDATE, INSERT

d. DECLARE, BEGIN, END

Question 12

In the DECLARE section of the PL/SQL block,

Select one:

a. SQL statements are being executed

b. You define variables.

c. Actions are performed when error occurs

d. All of the choices

Question 13

Which of the following rules is INCORRECT about cursor variables?

Select one:

a. You cannot use cursor variables with remote subprograms on another server.

b. None of the choices.

c. You cannot use REF CURSOR types in CREATE TABLE or VIEW statements.

d. You cannot assign a null value to cursor variables.

e. Cursors and cursor variables are not interoperable.


f. You cannot use comparison operators to test cursor variables.

Question 14

Use column aliases in cursors for calculated columns fetched into records declared with %COLUMNTYPE.

Select one:

True

False

Question 15

You have been tasked to update the database by creating a PL/SQL to increase the salary of all IT Programmer
employees by 50% of their existing salary.

Which of the following will execute successfully?

Select one:

a. DECLARE
v_job_id employees.job_id%TYPE := 'IT_PROG';
BEGIN
UPDATE employees SET salary = salary *0.50 WHERE job_id = v_job_id;
END;

b. DECLARE
v_job_id employees.job_id%TYPE := 'IT_PROG';
BEGIN
UPDATE employees SET salary = salary * 50% WHERE job_id = v_job_id;
END;

c. DECLARE
v_job_id employees.job_id%TYPE := 'IT_PROG';
v_salary employees.salary := salary;
BEGIN
UPDATE employees SET salary = v_salary * 0.50% WHERE job_id = v_job_id;
END;

d. DECLARE
v_job_id employees.job_id%TYPE := 'IT_PROG';
v_salary employees.salary := salary;
BEGIN
UPDATE employees SET v_salary = salary * 0.50 WHERE v_job_id = job_id;
END;

Question 16

Which if the following is NOT a benefits of using modular program constructs?

Select one:

a. None of the choices

b. Improved code clarity


c. Improved performance

d. Easy maintenance

e. Improved data security and integrity

Question 17

You have been tasked to update the database by creating a PL/SQL to increase the salary of all IT Programmer
employees by 100% of their existing salary. Which of the following will execute successfully?

Select one:

a. DECLARE
v_job_id employees.job_id%TYPE := 'IT_PROG';
BEGIN
UPDATE employees SET salary = salary * 2 WHERE job_id = v_job_id;
END;

b. DECLARE
v_job_id employees.job_id%TYPE := 'IT_PROG';
BEGIN
UPDATE employees SET salary = salary * 100% WHERE job_id = v_job_id;
END;

c. DECLARE
v_job_id employees.job_id%TYPE := 'IT_PROG';
v_salary employees.salary := salary;
BEGIN
UPDATE employees SET v_salary = salary * 1.00 WHERE v_job_id = job_id;
END;

d. DECLARE
v_job_id employees.job_id%TYPE := 'IT_PROG';
v_salary employees.salary := salary;
BEGIN
UPDATE employees SET salary = v_salary * 0.100% WHERE job_id = v_job_id;
END;

Question 18

Which of the following will erase all records in the departments table

Select one:

a. DELETE * FROM departments

b. TRUNCATE TABLE departments

c. DELETE FROM departments

d. TRUNCATE FROM TABLE departments

Question 19
A Cartesian product is formed when:

Select one:

a. All of the choices

b. All rows in the first table are joined to all rows in the second table

c. A join condition is invalid

d. A join condition is omitted

Question 20

You want to display all employee id, name, hired date and salary who are hired after employee 104 was hired.

Select one:

a. SELECT employee_id, last_name, hire_date, salary FROM employees WHERE TO_NUMBER(TO_CHAR(hire_date,


'YYYY')) > (SELECT TO_NUMBER(TO_CHAR(hire_date, 'YYYY')) FROM employees WHERE employee_id = 104)

b. SELECT employee_id, last_name, hire_date, salary FROM employees WHERE TO_NUMBER((hire_date, 'YYYY') IN
(SELECT TO_NUMBER(hire_date, 'YYYY') FROM employees WHERE
employee_id = 104)

c. SELECT employee_id, last_name, hire_date, salary FROM employees WHERE TO_NUMBER(TO_CHAR(hire_date,


'YYYY')) ALL
(SELECT TO_NUMBER(TO_CHAR(hire_date, 'YYYY')) FROM employees WHERE employee_id = 104)

d. SELECT employee_id, last_name, hire_date, salary FROM employees WHERE TO_CHAR(hire_date, 'YYYY') ANY
(SELECT TO_CHAR(hire_date, 'YYYY') FROM employees WHERE employee_id = 104)

Question 21

Which of the following PL/SQL that will display the total number employees whose salary is 10000 and above?

Select one:

a. DECLARE
v_salary employees.salary%TYPE := 10000;
BEGIN
SELECT COUNT(*) INTO v_salary FROM employees WHERE salary >= v_salary;
DBMS_OUTPUT.PUT_LINE(v_salary);
END;

b. None of the Choices

c. DECLARE
v_salary employees.salary%TYPE :>= 10000;
BEGIN
SELECT COUNT(salary) INTO v_salary FROM employees WHERE salary >= v_salary;
DBMS_OUTPUT.PUT_LINE(‘Total:’ || v_salary);
END;
d. DECLARE
v_salary TYPE%NUMERIC >= 10000;
BEGIN
SELECT COUNT(salary) INTO v_salary FROM employees WHERE salary >= v_salary;
DBMS_OUTPUT.PUT_LINE(‘Total:’ || v_salary);
END;

Question 22

Nathaniel had accidentally deleted all the records in the newly updated ORACLE database using the DELETE SQL
command.
What is the best solution that he can do to restore all the deleted records in the database.

Select one:

a. Restore the backup copy

b. None of the choices

c. Re-encode the data

d. Run the ROLLBACK command

e. Execute the UNDELETE command

Question 23

Fetch into a record when fetching from a cursor.

Select one:

True

False

Question 24

In PL/SQL Block Structure, which of the following are OPTIONAL?

Select one:

a. BEGIN and EXCEPTION

b. None of the choices

c. DECLARE and BEGIN

d. EXCEPTION and END

e. BEGIN and END

f. DECLARE and END

Question 25
Which of the following DOES NOT describes the state of the data after the COMMIT command

Select one:

a. The previous state of the data is overwritten.

b. None of the choices

c. All savepoints are erased.

d. Locks on the affected rows are released; those rows are available for other users to manipulate.

e. Data changes are saved in the database.

f. All users can view the results.

Question 26

Evaluate the folllowing PL/SQL

1. DECLARE

2. v_job_id employees.job_id%TYPE := 'IT_PROG';

3. v_last_name employees.last_name%TYPE := 'Lim';

4. v_first_name employees.first_name%TYPE := 'Steven';

5. BEGIN

6. INSERT INTO employees (employee_id, last_name, first_name, email, hire_date, job_id, salary)

7. VALUES (employees_seq.NEXTVAL, v_last_name, v_first_name,


v_last_name||v_first_name||'@gmail.com', CURRENT_DATE, v_job_id, 63000);

8. END;

Select one:

a. Error in Line 7. Due to invalid variables.

b. No Error.

c. Error in variable declaration

d. Error in Line 7. Invalid due to syntax in concatenation.

e. Error in Line 6. All fieldnames should be included.

Question 27

PL/SQL Provides a block structure for executable units of ________________.

Select one:

a. Code
b. Information

c. Data

d. Table

Question 28

Evaluate the following SQL command


SELECT employee_id, hire_date, department_name FROM employees, departments
WHERE departments.department_id = employees.department_id

Select one:

a. The SQL command will give an incorrect output.

b. The SQL command should have ALIAS for the table to produce a correct output.

c. The SQL command will produce a correct output.

d. The SQL command will produce an error.

Question 29

These are local variables declared in the parameter list of a subprogram specification.

Select one:

a. Actual arguments

b. Formal parameter

c. Actual parameter

d. Passing parameter

Question 30

Which of the following does NOT describes SELECT Statement in a PL/SQL.

Select one:

a. Queries must return only one column.

b. The INTO clause is required.

c. WHERE clause is required.

d. INTO clause should be followed by a varible name

Question 31

What is the exception name when PL/SQL has an internal problem

Select one:
a. EXECUTION_ERROR

b. ERROR_MSG

c. RUNTIME_ERROR

d. PROGRAM_ERROR

Question 32

What is the default parameter mode when no mode is specified?

Select one:

a. IN OUT

b. OUT

c. IN

d. DEFAULT

Question 33

Which of the following command is used to create a stand-alone procedure that is stored in the Oracle database?

Select one:

a. PROCEDURE

b. DO PROCEDURE

c. CREATE PROCEDURE

d. CREATE

e. BUILD PROCEDURE

Question 34

You can use this procedure to issue user-defined error messages from stored subprograms.

Select one:

a. SUB_ROUTINE

b. CALL_FUNCTION

c. USER_DEFINED_PROC

d. RAISE_APPLICATION_ERROR

e. PROCEDURE
Question 35

When an exception is predefined by Oracle server, the exception is raised ____________ .

Select one:

a. Implicitly

b. Interactively

c. Exclusively

d. Explicitly

e. None of the choices

Question 36

Evaluate the following PL/SQL. Which of the following will line creates an error?

1. CREATE OR REPLACE PROCEDURE query_emp


2. (
3. p_department_id IN employees.department_id%TYPE,
4. p_name OUT employees.last_name%TYPE,
5. p_salary OUT employees.salary%TYPE
6. )
7. IS
8. BEGIN
9. SELECT last_name, salary, department_id INTO p_name, p_salary, p_department_id
10. FROM employees
11. WHERE salary >= p_salary AND department_id = p_department_id ;
12. END query_emp;

Select one:

a. Line 5

b. Line 9

c. No error

d. Line 3

e. Line 1

f. Line 11

Question 37

SQL command to create a marker in the current transaction.

Select one:

a. POINTER
b. SAVEMARKER

c. INDEX

d. SAVEPOINT

e. SAVEMORE

Question 38

Procedure can be stored in the database as a schema object.

Select one:

True

False

Question 39

Evaluate the following PL/SQL.

1. CREATE OR REPLACE PROCEDURE query_employee


2. (p_id IN employees.employee_id%TYPE,
3. p_name OUT employees.last_name%TYPE,
4. p_salary OUT employees.salary%TYPE) IS
5. BEGIN SELECT last_name, salary INTO p_name, p_salary
6. FROM employeesWHERE employee_id = p_id;
7. END query_employee

Select one:

a. The stored procedure will create an error in line 5

b. No error

c. The stored procedure will create an error in line 2 to 4.

d. The stored procedure will create an error in line 7

Question 40

Which of the following is the syntax to open a cursor varial

Select one:

a. OPEN cursor_variable_name
FOR select_statement;

b. GET cursor_variable_name
FOR select_statement;

c. SET cursor_variable_name
FOR select_statement;
d. LOAD cursor_variable_name
FOR select_statement;

Question 41

Which of the folllowing does NOT describes subprogram? i. Compiled only once ii. Stored in the database iii. Do not
return values iv. Can take parameters v. Unnamed PL/SQL blocks

Select one:

a. iii & v

b. i & iii

c. ii & v

d. iii & iv

Question 42

You want to cancel the privilege of matt to add records from the employees table.

Select one:

a. REVOKE insert ON employees FROM matt;

b. REVOKE insert ON matt FROM employees;

c. REVOKE matt FROM employees TO insert;

d. REVOKE employees FROM matt TO insert;

Question 43

Evaluate the given SQL syntax


INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...)
WHERE condition;

Select one:

a. Correct syntax.

b. This will produce an error.

c. INSERT should be UPDATE command

d. Wrong placement of WHERE and VALUES

Question 44

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'

Select one:
a. This will return an error. "ANY" can not be compared to salary

b. This will return an error. Parenthesis in the subquery should be removed.

c. This will return an error. Employees table can not be used in the subquery if it used in the main query.

d. This has no error.

Question 45

This is a subset of an existing data type that may place a constraint on its base type.

Select one:

a. Subtype

b. Data dictionary

c. Schema

d. Index

e. Data

Question 46

This is a subset of an existing data type that may place a constraint on its base type.

Select one:

a. Schema

b. Data dictionary

c. Subtype

d. Data

e. Index

Question 47

PL/SQL Provides a block structure for executable units of ________________.

Select one:

a. Information

b. Data

c. Code

d. Table
Question 48

Given the DEPARTMENTS table and USER user1, evaluate the SQL command:

GRANT select

ON user1

TO departments;

Select one:

a. The following will grant query privileges on the DEPARTMENTS table:

b. The folllowing will grant object privileges on USER user1

c. The SQL command is incorrect

d. None of the choices

Question 49

Evaluate the SQL command


SELECT employee_id, job_id, salary from employees where salary < ALL (SELECT salary FROM employees WHERE job_id =
'FI_ACCOUNT') AND job_id = 'IT_PROG'

Select one:

a. This will return an error. No data will be displayed.

b. This will return an error. Job_id FI_ACCOUNT and IT_PROG conflicts.

c. This will return an error. Invalid parameter "ALL".

d. This has no error.

Question 50

In the DECLARE section of the PL/SQL block

Select one:

a. Actions are performed when error occurs

b. All of the choices

c. SQL statements are being executed

d. You define variables.

Started on Friday, 3 January 2020, 1:05 AM

State Finished

Completed on Friday, 3 January 2020, 1:26 AM


Time taken 21 mins 19 secs

Grade 50.00 out of 50.00 (100%)

Question 1

Evaluate the following PL/SQL. Which of the following will line creates an error?

1. CREATE OR REPLACE PROCEDURE query_emp


2. (
3. p_department_id IN employees.department_id%TYPE,
4. p_name OUT employees.last_name%TYPE,
5. p_salary OUT employees.salary%TYPE
6. )
7. IS
8. BEGIN
9. SELECT last_name, salary, department_id INTO p_name, p_salary, p_department_id
10. FROM employees
11. WHERE salary >= p_salary AND department_id = p_department_id ;
12. END query_emp;

Select one:

a. Line 5

b. Line 3

c. Line 1

d. No error

e. Line 11

f. Line 9

Question 2

You want to know the total number of employees whose firstname starts with letter D.

Which of the folllowing PLS/SQL executes successfully?

Select one:

a. DECLARE
v_first_name employees.first_name%TYPE := 'D%';
BEGIN
SELECT COUNT(*) INTO v_first_name FROM employees WHERE first_name LIKE v_first_name;
DBMS_OUTPUT.PUT_LINE(v_first_name);
END;

b. None of the choices

c. DECLARE
v_first_name VARCHAR(20) = ‘D%’;
BEGIN
SELECT COUNT(*) INTO v_first_name FROM employees WHERE first_name LIKE v_first_name;
DBMS_OUTPUT.PUT_LINE(v_first_name);
END;

d. DECLARE
v_first_name employees.first_name%TYPE LIKE 'D%';
BEGIN
SELECT COUNT(*) INTO v_first_name FROM employees WHERE first_name = v_first_name;
DBMS_OUTPUT.PUT_LINE(v_first_name);
END;

Question 3

Actions are being performed when error occurs during PL/SQL execution in the

Select one:

a. BEGIN section

b. ERROR HANDLING

c. EXCEPTION

d. FUNCTION

Question 4

Which of the following PL/SQL will execute successfully?

Select one:

a. DECLARE
v_salary INTEGER(20);
BEGIN
SELECT salary FROM employees WHERE employee_id = 150;
DBMS_OUTPUT(v_salary);
END;

b. DECLARE
v_salary INTEGER(20);
BEGIN
SELECT salary INTO v_salary FROM employees WHERE employee_id = 150;
END;

c. DECLARE
v_salary INTEGER(20);
BEGIN
SELECT salary FROM employees WHERE employee_id = 150;
DBMS_OUTPUT.SCREEN(v_salary);
END;

d. DECLARE
v_salary INTEGER(20);
BEGIN
SELECT * INTO v_salary FROM employees;
END;

Question 5

Weak REF CURSOR is very flexible.

Select one:

True

False

Question 6

TRUE OR FALSE.
A FOREIGN KEY is a field in one table that refers to the PRIMARY KEY in another table.

Select one:

True

False

Question 7

Which of the following provide privilege to update the employees table?

Select one:

a. GRANT update (salary) ON employees TO matt

b. ALTER ROLE update GRANT ROLE employees

c. ALTER matt GRANT update ROLE employees

d. GRANT matt TO update ON employees

Question 8

When an exception is user defined, the exception is raised ____________ .

Select one:

a. None of the choices

b. Implicitly

c. Explicitly

d. Exclusively

e. Interactively

Question 9
Which of the following is the syntax to open a cursor varial

Select one:

a. OPEN cursor_variable_name
FOR select_statement;

b. GET cursor_variable_name
FOR select_statement;

c. LOAD cursor_variable_name
FOR select_statement;

d. SET cursor_variable_name
FOR select_statement;

Question 10

These are local variables declared in the parameter list of a subprogram specification.

Select one:

a. Passing parameter

b. Formal parameter

c. Actual arguments

d. Actual parameter

Question 11

You have been tasked to update the database by creating a PL/SQL to increase the salary of all IT Programmer
employees by twice of their existing salary. Which of the following will execute successfully?

Select one:

a. None of the above

b. DECLARE
v_job_id employees.job_id%TYPE := 'IT_PROG';
v_salary employees.salary := salary;
BEGIN
UPDATE employees SET v_salary = salary * 2 WHERE v_job_id = job_id;
END;

c. DECLARE
v_job_id employees.job_id%TYPE := 'IT_PROG';
BEGIN
UPDATE employees SET salary = salary * 2 WHERE job_id = v_job_id;
END;

d. DECLARE
v_job_id employees.job_id%TYPE := 'IT_PROG';
v_salary employees.salary := salary;
BEGIN
UPDATE employees SET salary = v_salary * 2 WHERE job_id = v_job_id;
END;

Question 12

PL/SQL stands for

Select one:

a. Procedural Logic of SQL

b. Procedural Libraries of SQL

c. Procedural Language extension to SQL

d. Process Linkage to SQL

Question 13

Which of the following command will delete all records in the table employees

Select one:

a. DELETE ALL FROM employees

b. DELETE FROM employees

c. DELETE employees WHERE ORASYS_REC > 0

d. DELETE ALL RECORDS employees

Question 14

Which of the following is the syntax to define a REF CURSOR type?

Select one:

a. DEFINE ref_type_name AS REF CURSOR


[RETURN return_type];

b. DECLARE ref_type_name AS REF CURSOR


[RETURN return_type];

c. SET ref_type_name IS REF CURSOR


[RETURN return_type];

d. TYPE ref_type_name IS REF CURSOR


[RETURN return_type];

Question 15

Which of the following command is used to create a stand-alone procedure that is stored in the Oracle database?

Select one:
a. CREATE PROCEDURE

b. PROCEDURE

c. BUILD PROCEDURE

d. CREATE

e. DO PROCEDURE

Question 16

Evaluate the SQL command


SELECT employee_id, last_name, first_name, job_id FROM employees WHERE department_id = (SELECT
max(department_id) FROM employees GROUP BY department_id)

Select one:

a. This has no error.

b. This will return an error. Parenthesis in the subquery should be removed.

c. This will return an error. Department Id should be included in the list of field in the main query.

d. This will return an error. Single-row subquery returns more than one row.

Question 17

TRUE OR FALSE.
The INSERT statement can add multiple rows.

Select one:

True

False

Question 18

Which of the following is NOT a task of a Database Administrator

Select one:

a. Removing users

b. Removing tables

c. None of the choices

d. Backing up tables

e. Creating new users

Question 19
Which of the following syntax to declare EXCEPTION named e_invalid_id?

Select one:

a. None of the choices

b. CREATE e_invalid_id EXCEPTION;

c. e_invalid_id AS EXCEPTION;

d. e_invalid_id EXCEPTION;

e. EXCEPTION e_invalid_id;

Question 20

Which of the following is INCORRECT?

Select one:

a. Use single-row operators with multiple-row subqueries

b. Enclose subqueries in parentheses

c. Use multiple-row operators with multiple-row subqueries

d. Place subqueries on the right side of the comparison condition

Question 21

This is a subset of an existing data type that may place a constraint on its base type.

Select one:

a. Subtype

b. Data dictionary

c. Schema

d. Index

e. Data

Question 22

Which of the folllowing is required in a subquery?

Select one:

a. HAVING BY

b. ORDER BY

c. GROUP BY
d. SELECT

Question 23

The PL/SQL code block helps modularize code by using:

Select one:

a. All of the choices

b. Functions

c. Anonymous blocks

d. Database triggers

e. Packages

f. Procedures

Question 24

Which of the folllowing statement describes PL/SQL?

Select one:

a. PL/SQL is an Oracle proprietary, procedural, unstructured programming language

b. PL/SQL is an Oracle proprietary, nonprocedural, 3GL programming language

c. PL/SQL is an Oracle proprietary, procedural, 3GL programming language

d. PL/SQL is an Oracle proprietary.

e. PL/SQL is a ANSI compliant, procedural and structured programming language

Question 25

When an exception is user defined, the exception is raised ____________ .

Select one:

a. Implicitly

b. Explicitly

c. Exclusively

d. Interactively

e. None of the choices

Question 26

In PL/SQL Block Structure, which of the following are mandatory?


Select one:

a. BEGIN and EXCEPTION

b. DECLARE and END

c. DECLARE and BEGIN

d. BEGIN and END

e. EXCEPTION and END

Question 27

Which of the following is the syntax to close a cursor?

Select one:

a. CLOSE cursor_variable_name;

b. SET cursor_variable_nameCLOSE;

c. QUIT cursor_variable_name;

d. EXIT cursor_variable_name;

Question 28

Procedure can be stored in the database as a schema object.

Select one:

True

False

Question 29

Fetch into a record when fetching from a cursor.

Select one:

True

False

Question 30

Evaluate the following. What will be the output?

1. DECLARE
2. SUBTYPE Accumulator IS NUMBER (4,2);
3. v_amount accumulator;
4. v_num1 NUMBER;
5. v_num2 NUMBER;
6. v_num3 NUMBER;
7. BEGIN
8. v_amount := 10.50;
9. v_num1 := 1;
10. v_num2 := 2;
11. v_num3 := 3;
12. v_num1 := v_amount;
13. v_num2 := v_num1 + v_amount;
14. v_num2 := v_num2 - v_num3;
15.
16. dbms_output.put_line('Total is: ' || v_num2);
17.
18. END;

Select one:

a. None of the choices

b. -1

c. 8.5

d. 18

Question 31

This is a subset of an existing data type that may place a constraint on its base type.

Select one:

a. Subtype

b. Index

c. Data

d. Data dictionary

e. Schema

Question 32

This is a type of cursor which is created and managed internally by the Oracle server to process SQL statements

Select one:

a. Interactive

b. Explicit

c. Implicit

d. Exclusive

e. Coded

Question 33
Which of the following is the syntax to fetch from a cursor variable?

Select one:

a. GET cursor_variable_name INTO variable_name1


[,variable_name2,. . .] | record_name;

b. POST cursor_variable_name INTO variable_name1


[,variable_name2,. . .] | record_name;

c. FETCH cursor_variable_name INTO variable_name1


[,variable_name2,. . .] | record_name;

d. RETRIEVE cursor_variable_name INTO variable_name1


[,variable_name2,. . .] | record_name;

Question 34

A Database Administrator can create and remove users and tables.

Select one:

a. The statement is incorrect. DBA can only create users and tables. Removal of users and tables will be done by the
higher authority of the database.

b. The statement is correct

c. The statement is incorrect. Only users of the database can be created by the Database Administrator.

d. The information is insufficient.

Question 35

Angelica is the Oracle Database Administrator. She was been assigned to create an access for the newly hired employee
named Matt to the Oracle Database.

Which of the following SQL command Angelica will execute?

Select one:

a. CREATE USERNAME matt PASSWORD 1234

b. CREATE USER FR0M DB_USER SET user

c. CREATE matt ACCESS 1234

d. CREATE USER matt IDENTIFIED BY 1234

e. None of the choices

Question 36

You can trap any error by including a corresponding handler within the exception-handling section of the PL/SQL block.

Select one:
True

False

Question 37

Which of the following rules is INCORRECT about cursor variables?

Select one:

a. You cannot assign a null value to cursor variables.

b. You cannot use REF CURSOR types in CREATE TABLE or VIEW statements.

c. None of the choices.

d. You cannot use comparison operators to test cursor variables.

e. Cursors and cursor variables are not interoperable.

f. You cannot use cursor variables with remote subprograms on another server.

Question 38

What is the default parameter mode when no mode is specified?

Select one:

a. OUT

b. IN

c. DEFAULT

d. IN OUT

Question 39

Evaluate the following PL/SQL.

1. CREATE OR REPLACE PROCEDURE query_employee


2. (p_id IN employees.employee_id%TYPE,
3. p_name OUT employees.last_name%TYPE,
4. p_salary OUT employees.salary%TYPE) IS
5. BEGIN SELECT last_name, salary INTO p_name, p_salary
6. FROM employeesWHERE employee_id = p_id;
7. END query_employee

Select one:

a. No error

b. The stored procedure will create an error in line 5


c. The stored procedure will create an error in line 7

d. The stored procedure will create an error in line 2 to 4.

Question 40

Which of the following describes weak REF CURSOR?

Select one:

a. All of the choices

b. Associates with any query

c. Is not flexible

d. Restrictive

Question 41

Which of the following DOES NOT describes an exception?

Select one:

a. Exception is a PL/SQL error that is raised before program execution.

b. An exception can be raised implicitly by the Oracle server

c. None of the choices

d. An exception can be handled by trapping it with a handler

e. An exception can be raisedexplicitly by the program

Question 42

Which if the following is NOT a benefits of using modular program constructs?

Select one:

a. None of the choices

b. Improved code clarity

c. Easy maintenance

d. Improved data security and integrity

e. Improved performance

Question 43

TRUE OR FALSE.
Multiple fields in NOT allowed in a Foreign key.
Select one:

True

False

Question 44

Which of the following syntax to declare EXCEPTION named e_invalid_id?

Select one:

a. None of the choices

b. e_invalid_id AS EXCEPTION;

c. EXCEPTION e_invalid_id;

d. CREATE e_invalid_id EXCEPTION;

e. e_invalid_id EXCEPTION;

Question 45

A join between two tables that returns the results of an INNER join as well as the results of a left and right join is a
_____________.

Select one:

a. NATURAL JOIN

b. FULL OUTER JOIN

c. OUTER JOIN

d. INNER JOIN

Question 46

INSERT, DELETE, UPDATE are ________________ commands

Select one:

a. All of the choices

b. DDL

c. DCL

d. DML

Question 47

Which of the folllowing does NOT describes subprogram? i. Compiled only once ii. Stored in the database iii. Do not
return values iv. Can take parameters v. Unnamed PL/SQL blocks
Select one:

a. ii & v

b. i & iii

c. iii & v

d. iii & iv

Question 48

What is the exception name when single row SELECT returned no data.

Select one:

a. NO_DATA_FOUND

b. END_OF_DATA

c. ZERO_RECORDS_FOUND

d. NO_RECORDS_FOUND

Question 49

Which of the following does NOT describes SELECT Statement in a PL/SQL.

Select one:

a. Queries must return only one column.

b. WHERE clause is required.

c. INTO clause should be followed by a varible name

d. The INTO clause is required.

Question 50

When an exception is predefined by Oracle server, the exception is raised ____________ .

Select one:

a. Exclusively

b. None of the choices

c. Explicitly

d. Interactively

e. Implicitly

You might also like