Uploaded by PR-Bernabe, Divine

prog-3113-oracle-database-2020-new-source

advertisement
lOMoAR cPSD| 13175991
Prog 3113 Oracle Database 2020 new source
Programming (Oracle Database) NCIII (AMA Computer University)
Studocu is not sponsored or endorsed by any college or university
Downloaded by PR- Divine Bernabe (divinebernabe29@gmail.com)
lOMoAR cPSD| 13175991
2020 PROG 3113 ORACLE DATABASE LEGIT SOURCE
WEEK 1-9 ONLY
Written Work 1 – 14/14
Performance Task 1 – 19/20
Written Work 2 – 10/10
Performance Task 2 – 20/20
Started on
State
Completed on
Time taken
Grade
Monday, 24 August 2020, 4:33 PM
Finished
Monday, 24 August 2020, 4:37 PM
4 mins 57 secs
14.00 out of 14.00 (100%)
Question 1
Complete
Mark 1.00 out of 1.00
Flag question
Question text
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 INTO 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 FROM jobs VALUES ('DB_ADMIN', 'Database Administrator', 10000, 18000)
d. INSERT * FROM jobs VALUES ('DB_ADMIN', 'Database Administrator', 10000, 18000)
Question 2
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Downloaded by PR- Divine Bernabe (divinebernabe29@gmail.com)
lOMoAR cPSD| 13175991
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 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.
c. The information is insufficient.
d. The statement is correct
Question 3
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Actions are being performed when error occurs during PL/SQL execution in the
Select one:
a. EXCEPTION
b. ERROR HANDLING
c. FUNCTION
d. BEGIN section
Question 4
Complete
Mark 2.00 out of 2.00
Flag question
Question text
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 WHERE price < 500 ORDER BY warehouse,
class FROM parts
Downloaded by PR- Divine Bernabe (divinebernabe29@gmail.com)
lOMoAR cPSD| 13175991
b. SELECT partnum, description, warehouse, onhand, price FROM parts WHERE price < 500 ORDER BY
warehouse, class;
c. SELECT partnum, description, warehouse, onhand, price FROM parts ORDER BY warehouse, class
WHERE price < 500;
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 5
Complete
Mark 1.00 out of 1.00
Flag question
Question text
1.
The two development environments of Oracle are
and
Select one:
a. Oracle SQL Developer; SQL command line
b. Oracle DB; SQL command line
c. Oracle SQL Developer; ANSI SQL Web
d. ANSI SQL Web; Oracle Net SQL
Question 6
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Actions are being performed when error occurs during PL/SQL execution in the
Select one:
a. BEGIN section
Downloaded by PR- Divine Bernabe (divinebernabe29@gmail.com)
.
lOMoAR cPSD| 13175991
b. FUNCTION
c. ERROR HANDLING
d. EXCEPTION
Question 7
Complete
Mark 1.00 out of 1.00
Flag question
Question text
A
consists of a collection of DML statements that form a logical unit of work.
Select one:
a. Transaction
b. SQL command
c. Database
d. All of the choices
Question 8
Complete
Mark 4.00 out of 4.00
Flag question
Question text
Display employee id, lastname, firstname, department name, annual salary, location id of employees
whose location id is 1700 and working in Finance Department. Label the annual salary to ANNUAL
SALARY.
Sort the output in from highest to lowest salary. (4 POINTS)
Select one:
a. SELECT E.employee_id, E.last_name, E.first_name, D.department_name, E.salary*12 AS "ANNUAL
SALARY", D.location_id
FROM employees E
JOIN jobs J ON E.job_id = J.job_id
JOINemployees E ON E.department_id = D.department_id
WHERE D.location_id = 1700 AND D.department_name = 'Finance'
Downloaded by PR- Divine Bernabe (divinebernabe29@gmail.com)
lOMoAR cPSD| 13175991
ORDER BY "ANNUAL SALARY" DESC
b. SELECT E.employee_id, E.last_name, E.first_name, D.department_name, E.salary*12 AS "ANNUAL
SALARY", D.location_id
FROM employees E
NATURAL JOIN jobs J ON E.job_id = J.job_id
NATURAL JOIN departments D ON E.department_id = D.department_id
ORDER BY "ANNUAL SALARY" DESC
WHERE D.location_id = 1700 AND D.department_name = 'Finance'
c. SELECT E.employee_id, E.last_name, E.first_name, D.department_name, E.salary*12 AS "ANNUAL
SALARY", D.location_id
FROM employees E
OUTER JOIN jobs J ON E.job_id = J.job_id
OUTER JOIN departments D ON E.department_id = D.department_id
WHERE D.location_id = 1700 AND D.department_name = 'Finance'
ORDER BY "ANNUAL SALARY" DESC
d. SELECT E.employee_id, E.last_name, E.first_name, D.department_name, E.salary*12 AS "ANNUAL
SALARY", D.location_id
FROM employees E
JOIN jobs J ON E.job_id = J.job_id
JOIN departments D ON E.department_id = D.department_id
WHERE D.location_id = 1700 AND D.department_name = 'Finance'
ORDER BY "ANNUAL SALARY" DESC
Question 9
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Command use to display table structure
Select one:
a. DISPLAY TABLE
b. DISPLAY
c. DISPLAY STRUCTURE
d. DESCRIBE
Question 10
Complete
Mark 1.00 out of 1.00
Downloaded by PR- Divine Bernabe (divinebernabe29@gmail.com)
lOMoAR cPSD| 13175991
Flag question
Question text
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 matt ACCESS 1234
c. CREATE USER matt IDENTIFIED BY 1234
d. CREATE USERNAME matt PASSWORD 1234
e. CREATE USER FR0M DB_USER SET user
Question 1
Answer saved
Marked out of 1.00
Flag question
Question text
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 partnumber, 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_';
Downloaded by PR- Divine Bernabe (divinebernabe29@gmail.com)
lOMoAR cPSD| 13175991
e. SELECT partnum, description, warehouse FROM parts WHERE partnum LIKE '*K*';
f. SELECT * FROM parts WHERE partnum LIKE 'K%';
g. SELECT partnum, description, warehouse FROM parts WHERE partnum = LIKE ‘K%’;
Display all the records sorted by price from most expensive to the cheapest parts.
Select one:
a. SELECT * FROM parts SORT BY price DESC
b. SELECT * FROM parts ORDER BY price
c. SELECT * FROM parts SORT BY price
d. SELECT ALL FROM price SORT BY parts HIGHETS
e. SELECT ALL FROM parts SORT BY price HIGHEST
f. SELECT ALL FROM parts ORDER BY price
g. SELECT * FROM parts ORDER BY price DESC
Display all the records whose stock is below 20 and in warehouse number 3.
Select one:
a. SELECT ALL FROM parts WHERE onhand< 20 AND warehouse = 3;
b. SELECT ALL FROM parts WHERE onhand<= 20 AND warehouse = 3;
c. SELECT * FROM parts WHERE onhand< 20 OR warehouse = 3;
d. SELECT * FROM parts WHERE onhand<= 20 AND warehouse = 3;
e. SELECT * FROM parts WHERE onhand> 20 OR warehouse = 3;
f. SELECT * FROM parts WHERE onhand< 20 AND warehouse = 3;
Create a SQL command to update the employees table:
Employee id :250
Name : Aldrin Rich
Date hired : July 1, 2017
Position :Accountant
Salary : 10000
Department of assignment : 100
Reporting to manager :108
Select one:
a. INSERT FROM employees VALUES (250,'Aldrin','Rich',TO_DATE('Jul 1, 2017', 'MON
DD, YYYY'), 'ACCOUNTANT', 10000, 103, 60)
Downloaded by PR- Divine Bernabe (divinebernabe29@gmail.com)
lOMoAR cPSD| 13175991
b. INSERT FROM employees VALUES (250,'Aldrin','Rich', TO_CHAR('Jul 1, 2017', 'MON
DD, YYYY'), 'ACCOUNTANT', 10000, 103, 60)
c. INSERT INTO employees
(employee_id,first_name,last_name,hire_date,job_id,salary,manager_id,department
_id) VALUES (250,'Aldrin','Rich',TO_DATE('Jul 1, 2017', 'MON DD, YYYY'),
'ACCOUNTANT', 10000, 103, 60)
d. INSERT INTO employees
(employee_id,first_name,last_name,hire_date,job_id,salary,manager_id,department
_id) VALUES (250,'Aldrin','Rich', TO_CHAR('Jul 1, 2017', 'MON DD, YYYY'),
'ACCOUNTANT', 10000, 103, 60)
Display all location id between 1000 to 2000.
Select one:
a. DISPLAY location_id FROM departments WHERE location_id BETWEEN 1000 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 LING 1000 UP TO 2000
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, salary/3000 FROM employees WHERE job_id =
'IT_PROG'
b. SELECT employee_id, job_id, salary, MOD(salary, 3000) FROM employees WHERE
job_id = 'IT_PROG'
c. SELECT employee_id, job_id, salary, REM(salary/3000) FROM employees WHERE
job_id = 'IT_PROG'
d. SELECT employee_id, job_id, salary FROM employees WHERE job_id = 'IT_PROG'
AND salary/3000
e. SELECT employee_id, job_id, salary FROM employees WHERE job_id = 'IT_PROG'
AND MOD(salary, 3000)
Diana Lorentz was transferred to Administration department. Using the employees
and department table information update the profile of employee.
Downloaded by PR- Divine Bernabe (divinebernabe29@gmail.com)
lOMoAR cPSD| 13175991
Select one:
a. UPDATE FROM employees SET manager_id = 200, department_id = 10 WHERE
last_name = 'Lorentz' AND first_name = 'Diana';
b. UPDATE FROM employees SET manager_id = 200, SET department_id = 10 WHERE
last_name = 'Lorentz' AND first_name = 'Diana';
c. UPDATE employees SET manager_id = 200, SET department_id = 10 WHERE
last_name = 'Lorentz' AND first_name = 'Diana';
d. UPDATE employees SET manager_id = 200, department_id = 10 WHERE last_name
= 'Lorentz' AND first_name = 'Diana';
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, salary *12 FROM employees WHERE 12* salary =
100000 AND 12 *salary = 200000 ORDER BY salary
b. SELECT employee_id, salary FROM employees WHERE salary >= 100000 AND salary
<= 200000 ORDER BY salary
c. SELECT employee_id, salary FROM employees WHERE salary *12 >= 100000 AND
salary *12 <= 200000 ORDER BY salary desc
d. SELECT employee_id, salary FROM employees WHERE salary *12 >= 100000 AND
salary *12 <= 200000 ORDER BY salary
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(employee_id,last_name) AS Employee FROM employees WHERE
salary >5000 AND 10000
b. SELECT CONCAT(CONCAT(employee_id, ':'), last_name) AS Employee, salary FROM
employees WHERE salary >= 5000 AND salary <= 10000
c. SELECT CONCAT(employee_id, ':', last_name) AS Employee, salary FROM
employees WHERE salary BETWEEN 5000 TO 10000
d. SELECT CONCAT(CONCAT(employee_id, ':'), last_name) AS Employee FROM
employees WHERE salary >= 5000 AND salary <= 10000
Display all the records in the employee table. Arrange the output in by lastname from
Downloaded by PR- Divine Bernabe (divinebernabe29@gmail.com)
lOMoAR cPSD| 13175991
A-Z order.
Select one:
a. SELECT * FROM employees ORDER BY lastname
b. SELECT * FROM employees SORT BY lastname ascending
c. SELECT * FROM employees SORT BY lastname
d. SELECT * FROM employees ORDER BY lastname AZ
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 warehouseWHERE
SUM(ONHAND) > 50
b. SELECT warehouse, class, sum(onhand) FROM parts GROUP BY warehouse HAVING
SUM(ONHAND) > 50
c. SELECT warehouse, class, sum(onhand) FROM parts WHERE SUM(ONHAND) > 50
d. SELECT warehouse, class, sum(onhand) FROM parts GROUP BY warehouse,class
HAVING SUM(ONHAND) > 50
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 ORDER BY
department_id WHERE first_name LIKE 'D%' and job_id = 'IT_PROG'
b. 'IT_PROG' OR first_name LIKE 'D%' and 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 employees FROM employee_id, first_name, last_name WHERE first_name
LIKE ‘D%’ and job_id = ‘IT_PROG’ ORDER BY department_id
e. SELECT employee_id, first_name, last_name FROM employees WHERE first_name
LIKE 'D%' and job_id = 'IT_PROG' ORDER BY department_id
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
Downloaded by PR- Divine Bernabe (divinebernabe29@gmail.com)
lOMoAR cPSD| 13175991
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'
Display all employees whose job id contains the word 'ACCOUNT'.
Select one:
a. SELECT * FROM EMPLOYEES WHERE job_id LIKE '%ACCOUNT%';
b. SELECT * FROM EMPLOYEES WHERE job_id LIKE '%*ACCOUNT*%';
c. SELECT * FROM EMPLOYEES WHERE job_id LIKE '*ACCOUNT%';
d. SELECT * FROM EMPLOYEES WHERE job_id LIKE '_ACCOUNT_';
e. SELECT * FROM EMPLOYEES WHERE job_id LIKE '_ACCOUNT%';
Display all the employee id, names of employees , job id, hiring_date and department
name of all employees of the IT Department
Select one:
a. SELECT A.first_name, A.last_name, A.job_id, B.department_name, A.salary,
A.hire_date FROM employees A JOIN departments B ON ( A.department_id =
B.department_id) WHERE B.department_name = 'IT'
b. SELECT A.first_name, A.last_name, A.job_id, B.department_name, A.salary,
A.hire_date FROM employees A JOIN departments B JOIN ( A.department_id =
B.department_id) WHERE B.department_name = 'IT'
c. SELECT A.first_name, A.last_name, A.job_id, B.department_name, A.salary,
A.hire_date FROM employees A JOIN departments B WHERE ( A.department_id =
B.department_id) AND B.department_name = 'IT'
d. SELECT A.first_name, A.last_name, A.job_id, B.department_name, A.salary,
A.hire_dateFROM departments A JOIN employees B ON ( A.department_id =
B.department_id) WHERE B.department_name = 'IT'
Diana Lorentz was transferred to Administration department. Using the employees
and department table information update the profile of employee.
Select one:
Downloaded by PR- Divine Bernabe (divinebernabe29@gmail.com)
lOMoAR cPSD| 13175991
a. UPDATE employees SET manager_id = 200, department_id = 10 WHERE last_name
= 'Lorentz' AND first_name = 'Diana';
b. UPDATE FROM 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 employees SET manager_id = 200, SET department_id = 10 WHERE
last_name = 'Lorentz' AND first_name = 'Diana';
Clear my choice
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:
Error! Not a valid embedded object.a. SELECT CONCAT(last_name, first_name) AS
Fullname FROM employees;
b. SELECT CONCAT(last_name, ',', first_name) AS Fullname FROM employees
c. SELECT CONCAT(CONCAT(last_name, ','), first_name) AS Fullname FROM
employees;
d. SELECT CONCAT(last_name, first_name) FROM employees
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 FROM jobs SET jobs_id = ‘JAVA_DEV’, job_title = ‘Java Developer’ ,
min_salary =7000 , max_salary= 8000
b. INSERT FROM jobs(jobs_id, job_title, min_salary, max_salary) VALUES ('JAVA_DEV',
'Java Developer', 7000, 8000)
c. INSERT * INTO jobs VALUES (JAVA_DEV, Java Developer, 7000, 8000)
d. INSERT INTO jobs VALUES ('JAVA_DEV', 'Java Developer', 7000, 8000)
Create a SQL command to update the employees table
Employee id : 200
Name : Mr. Gary Park
Date hired : July 1, 2017
Downloaded by PR- Divine Bernabe (divinebernabe29@gmail.com)
lOMoAR cPSD| 13175991
Position :IT Programmer
Salary : 10000
Department of assignment : 60
Reporting to manager : 103
Select one:
a. 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)
b. 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)
c. INSERT FROM employees
VALUES (200,'Gary','Park', TO_CHAR('Jul 1, 2017', 'MON DD, YYYY'), 'IT_PROG', 10000,
103, 60)
d. INSERT FROM employees
VALUES (200,'Gary','Park',TO_DATE('Jul 1, 2017', 'MON DD, YYYY'), 'IT_PROG', 10000,
103, 60)
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 INNER JOIN departments B ON ( A.department_id = B.department_id)
ON B.department_name = 'Finance'
b. SELECT first_name, last_name, job_id, department_name FROM employees JOIN
department ON (department_id) WHERE department_name = 'Finance'
c. All of the choices
d. 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'
Downloaded by PR- Divine Bernabe (divinebernabe29@gmail.com)
lOMoAR cPSD| 13175991
Started on
State
Completed on
Time taken
Marks
Grade
Tuesday, 25 August 2020, 12:29 AM
Finished
Tuesday, 25 August 2020, 12:39 AM
9 mins 26 secs
20.00/20.00
100.00 out of 100.00
Question 1
Complete
Mark 1.00 out of 1.00
Flag question
Question text
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 2.
b. The PL/SQL will produce an error in line 4.
c. The PL/SQL will delete employee number 114.
d. To execute successfully delete line 1,2,3,5.
Question 2
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Evaluate the following SQL command
SELECT employee_id, salary, department_id FROM employees WHERE department_id IN (60,70)
Select one:
Downloaded by PR- Divine Bernabe (divinebernabe29@gmail.com)
lOMoAR cPSD| 13175991
a. The SQL command will produce an error.
b. The SQL command will display employees with department id 60 or 70.
c. The SQL command will display employees with department id 60 and 70.
d. The SQL command will give an incorrect output.
Question 3
Complete
Mark 1.00 out of 1.00
Flag question
Question text
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. 18
b. None of the choices
c. 8.5
d. -1
Question 4
Complete
Downloaded by PR- Divine Bernabe (divinebernabe29@gmail.com)
lOMoAR cPSD| 13175991
Mark 1.00 out of 1.00
Flag question
Question text
Evaluate the following SQL command
SELECT * FROM jobs WHERE job_title LIKE 'Manager%'
Select one:
a. The SQL command will produce an error.
b. No records will be displayed
c. The SQL command will display all employees with Manager position
d. The SQL command will display all records in the database
Question 5
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Evaluate the following PL/SQL. At what line number is the error of the PL/SQL?
DECLARE
v_deptno NUMBER := 800;
e_invalid EXCEPTION;
BEGIN
DELETE FROM departments
WHERE department_id = v_deptno;
IF SQL % NOT_FOUND THEN
RAISE e_invalid;
END IF;
COMMIT;
EXCEPTION
WHEN e_invalid THEN
DBMS_OUTPUT.PUT_LINE('No such department id.');
END;
Select one:
a. 8
Downloaded by PR- Divine Bernabe (divinebernabe29@gmail.com)
lOMoAR cPSD| 13175991
b. 2
c. 12
d. 7
e. 3
Question 6
Complete
Mark 1.00 out of 1.00
Flag question
Question text
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. Employees table can not be used in the subquery if it used in the main query.
c. This has no error.
d. This will return an error. Parenthesis in the subquery should be removed.
Question 7
Complete
Mark 1.00 out of 1.00
Flag question
Question text
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. Invalid parameter "ALL".
b. This will return an error. Job_id FI_ACCOUNT and IT_PROG conflicts.
Downloaded by PR- Divine Bernabe (divinebernabe29@gmail.com)
lOMoAR cPSD| 13175991
c. This will return an error. No data will be displayed.
d. This has no error.
Question 8
Complete
Mark 1.00 out of 1.00
Flag question
Question text
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 * 150 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 * 1.50% AS Bonus FROM employees
Question 9
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Evaluate the PL/SQL
1. DECLARE
2.
v_first_name VARCHAR2(50);
3.
v_last_name VARCHAR2(50);
4.
v_salary INTEGER(20);
5.
BEGIN
6. SELECT first_name, last_name, salary INTO v_first_name, v_last_name, v_salary FROM employees
WHERE department_id = 60;
7.
DBMS_OUTPUT.PUT_LINE('Firstname : '|| v_first_name);
8.
DBMS_OUTPUT.PUT_LINE('Lastname : '|| v_last_name);
Downloaded by PR- Divine Bernabe (divinebernabe29@gmail.com)
lOMoAR cPSD| 13175991
9.
DBMS_OUTPUT.PUT_LINE('Salary : '|| v_salary);
10. END;
Select one:
a. No Error.
b. Error in variable declaration
c. Error in Line 6.
d. Error in Line 7,8,9.
Question 10
Complete
Mark 1.00 out of 1.00
Flag question
Question text
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. The PL/SQL will produce an error in line 4.
c. The PL/SQL will produce an error in line 2.
d. To execute successfully delete line 1,2,3,5.
Question 11
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Downloaded by PR- Divine Bernabe (divinebernabe29@gmail.com)
lOMoAR cPSD| 13175991
Evaluate the PL/SQL
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
DECLARE
v_first_name VARCHAR2(50);
v_last_name VARCHAR2(50);
v_salary INTEGER(20);
BEGIN
SELECT first_name, last_name, salary INTO v_first_name, v_last_name, v_salary FROM
employees WHERE department_id = 60;
DBMS_OUTPUT.PUT_LINE('Firstname : '|| v_first_name);
DBMS_OUTPUT.PUT_LINE('Lastname : '|| v_last_name);
DBMS_OUTPUT.PUT_LINE('Salary : '|| v_salary);
END;
Select one:
a. Error in line 2,3,4
b. Error in Line 7,8,9.
c. Error in Line 6.
d. No Error.
Question 12
Complete
Mark 1.00 out of 1.00
Flag question
Question text
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:
Downloaded by PR- Divine Bernabe (divinebernabe29@gmail.com)
lOMoAR cPSD| 13175991
a. None of the choices
b. The PL/SQL block will run successfully.
c. An error will occur in declaration section.
d. An error will occur in EXCEPTION section.
e. An error will occur in SQL command.
Question 13
Complete
Mark 1.00 out of 1.00
Flag question
Question text
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 EXCEPTION section.
b. None of the choices
c. An error will occur in SQL command.
d. An error will occur in declaration section.
e. The PL/SQL block will run successfully.
Question 14
Complete
Mark 1.00 out of 1.00
Downloaded by PR- Divine Bernabe (divinebernabe29@gmail.com)
lOMoAR cPSD| 13175991
Flag question
Question text
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 display the employee id, department id and the minimum and maximum salary whose
salary is between 10000 and 20000.
c. The SQL will produce Cartesian Product
d. The SQL command will give an incorrect output.
Question 15
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Evaluate the SQL Command
SELECT job_id, job_title FROM jobs J WHERE INCLUDES
(SELECT * FROM employees WHERE J.job_id = e.job_id );
Select one:
a. The SQL will return an error. Main query should interchanged with the sub query.
b. This will return an error. Parenthesis in the subquery should be removed.
c. The SQL will return an error. Invalid "INCLUDES" parameter.
d. This has no error.
Question 16
Complete
Mark 1.00 out of 1.00
Downloaded by PR- Divine Bernabe (divinebernabe29@gmail.com)
lOMoAR cPSD| 13175991
Flag question
Question text
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 3
b. Line 1
c. Line 11
d. Line 5
e. No error
f. Line 9
Question 17
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Evaluate the given SQL syntax
INSERT INTO table_name (column1, column2, column3, ...)
Downloaded by PR- Divine Bernabe (divinebernabe29@gmail.com)
lOMoAR cPSD| 13175991
VALUES (value1, value2, value3, ...)
WHERE condition;
Select one:
a. This will produce an error.
b. INSERT should be UPDATE command
c. Wrong placement of WHERE and VALUES
d. Correct syntax.
Question 18
Complete
Mark 1.00 out of 1.00
Flag question
Question text
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 will produce an error.
c. The SQL command should have ALIAS for the table to produce a correct output.
d. The SQL command will produce a correct output.
Question 19
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Given the answer in item
, which of the folllowing stored procedure will display the
employee id and salary of Steven King?
Select one:
a. DECLARE
Downloaded by PR- Divine Bernabe (divinebernabe29@gmail.com)
lOMoAR cPSD| 13175991
v_employee_id employees.employee_id VARCHAR(10);
v_emp_sal employees.salary NUMERIC(10);
BEGIN
query_emp('King', 'Steven', v_employee_id, v_emp_sal);
DBMS_OUTPUT.PUT_LINE('Employee ID ' || v_employee_id ||' earns '|| to_char(v_emp_sal,
'$999,999.00'));
END;
b. DECLARE
query_emp('King', 'Steven', v_employee_id, v_emp_sal);
BEGIN
v_employee_id employees.employee_id VARCHAR(10);
v_emp_sal employees.salary NUMERIC(10);
DBMS_OUTPUT.PUT_LINE('Employee ID ' || v_employee_id ||' earns '|| to_char(v_emp_sal,
'$999,999.00'));
END;
c. DECLARE
v_employee_id employees.employee_id%TYPE;
v_emp_sal employees.salary%TYPE;
query_emp('King', 'Steven', v_employee_id, v_emp_sal);
BEGIN
DBMS_OUTPUT.PUT_LINE('Employee ID ' || v_employee_id ||' earns '|| to_char(v_emp_sal,
'$999,999.00'));
END;
d. DECLARE
v_employee_id employees.employee_id%TYPE;
v_emp_sal employees.salary%TYPE;
BEGIN
query_emp('King', 'Steven', v_employee_id, v_emp_sal);
DBMS_OUTPUT.PUT_LINE('Employee ID ' || v_employee_id ||' earns '|| to_char(v_emp_sal,
'$999,999.00'));
END;
Question 20
Complete
Mark 1.00 out of 1.00
Flag question
Question text
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)
Downloaded by PR- Divine Bernabe (divinebernabe29@gmail.com)
lOMoAR cPSD| 13175991
Select one:
a. This will return an error. Parenthesis in the subquery should be removed.
b. This will return an error. Single-row subquery returns more than one row.
c. This has no error.
d. This will return an error. Department Id should be included in the list of field in the main query.
Downloaded by PR- Divine Bernabe (divinebernabe29@gmail.com)
Download