Sei sulla pagina 1di 82

D.

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

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

Question text Question text


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

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

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

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

Question 7
Answer saved
Marked out of 1.00

Remove flag

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

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

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

d. The SQL command will display employees with Question 10


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

Question text Question text


You want to display the employee's last name whose What is the SQL command to display the date of the
salary is below 10,000 and whose lastname starts first employee that was hired?
with letter D.
Which SQL statement give the required output format Select one:
of the salary? a. SELECT FIRST(hire_date) FROM employees;
Select one: b. SELECT hire_date FROM employees WHERE
a. SELECT last_name, TO_INTEGER(salary, TO_CHAR(hire_date) = ‘FIRST’;
$999,999.99) AS "MONTHLY SALARY" FROM c. SELECT MIN(hire_date) FROM employees;
employees WHERE salary < 10000 WHERE
last_name IN 'D%' d. SELECT hire_date FROM employees WHERE
FIRST(hire_date );
b. SELECT last_name, TO_INT(salary,
'$999,999.99') AS "MONTHLY SALARY" FROM Question 13
employees WHERE salary < 10,000 WHERE Answer saved
last_name STARTS 'D%' Marked out of 1.00

c. SELECT last_name, TO_CHAR(salary,


'$999,999.99') AS "MONTHLY SALARY" FROM
employees WHERE salary < 10000 WHERE
last_name LIKE 'D%'
d. SELECT last_name, TO_NUMBER(salary, Flag question
'$999,999.99') AS "MONTHLY SALARY" FROM Question text
employees WHERE salary < 10,000 WHERE
last_name = ‘D%’ You want to display the employee id and the year
when an employee was hired.
Question 11 Which SQL statement give the required output?
Answer saved
Marked out of 1.00 Select one:
a. SELECT employee_id,
YEAR(hire_date,'YYYY') FROM employees;
b. SELECT employee_id, YEAR(hire_date')
FROM employees;
Flag question
c. SELECT employee_id,
Question text TO_YEAR(hire_date,'YYYY') FROM employees;
Which of the following will is the correct command to d. SELECT employee_id,
create a role. TO_CHAR(hire_date,'YYYY') FROM employees;
Select one:
Question 14
a. CREATE ROLE gen_manager Answer saved
Marked out of 1.00
b. None of the choices
c. GRANT ROLE gen_manager
d. CREATE gen_manager ROLE

Question 12 Remove flag


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

Select one: True

a. The SQL command will produce an error. False

b. The SQL command will give an incorrect Question 17


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

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


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

Question 16 a. SELECT AVERAGE(salary) FROM employees


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

Flag question d. SELECT COUNT AVG(salary) FROM


employees WHERE job_id = 'IT_PROG';
Question text
Question 19 Select one:
Answer saved
Marked out of 1.00 a. SELECT * FROM employees SORT BY
lastname
b. SELECT * FROM employees ORDER BY
lastname AZ
c. SELECT * FROM employees ORDER BY
Flag question lastname
Question text d. SELECT * FROM employees SORT BY
lastname ascending
A _______________ consists of a collection of DML
statements that form a logical unit of work. Question 22
Answer saved
Select one: Marked out of 1.00
a. All of the choices
b. Transaction
c. SQL command
d. Database Flag question

Question text
Question 20
Answer saved Austin David was transferred to Purchasing
Marked out of 1.00
Department. You are assigned to update the
database.
Which of the following SQL command will satisfy the
requirements?
Select one:
Remove flag
a. UPDATE first_name = ‘David’ AND last_name
Question text = ‘Austin’ FROM employees SET department_id = 30
Which of the following SELECT statement is the b. UPDATE employees SET department_id = 30
correct PL/SQL that will display all rows and WHERE first_name = ‘David’ AND last_name =
columns? ‘Austin’
Select one: c. UPDATE department_id = 30 WHERE
first_name = ‘David’ AND last_name = ‘Austin’
a. SELECT TABLE PARTS;
d. UPDATE employees WHERE department_id =
b. SELECT FROM TABLE PARTS; 30 SET first_name = ‘David’ AND last_name =
c. SELECT * FROM PARTS; ‘Austin’

d. SELECT ALL FROM PARTS; Question 23


Answer saved
Question 21 Marked out of 1.00
Answer saved
Marked out of 1.00

Flag question

Remove flag Question text

Question text The General Manager request to the Database


Administrator to generate the total number of parts
Display all the records in the employee table. Arrange and total outstanding balance on hand of every class
the output in by lastname from A-Z order. in warehouse number 1&2.
Which of the following SQL command will generate What privileges that manipulates the content of the
the required output. database objects.
Select one: Select one:
a. SELECT warehouse, class, count(partnum), a. Object Privileges
sum(onhand) GROUP BY warehouse,class HAVING
warehouse = 1 or warehouse = 2 FROM parts; b. Connection Privileges

b. SELECT warehouse, class, count(partnum), c. Network Privileges


sum(onhand) GROUP BY warehouse,class WHERE d. System Privileges
warehouse = 1 or warehouse = 2 FROM parts;
Question 26
c. SELECT warehouse, class, SUM(partnum), Answer saved
SUM(onhand) FROM parts GROUP BY Marked out of 1.00
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; Remove flag

Question text
Question 24
Answer saved Each row of data in a table can be uniquely identified
Marked out of 1.00 by a
Select one:
a. foreign key
b. primary key
Flag question
c. local key
Question text
d. relational key
John want to know how many employees receiving
salary below 10,000. e. index key
What SQL command he need to run?
Question 27
Select one: Answer saved
Marked out of 1.00
a. SELECT COUNT(salary) FROM employees
WHERE salary < 10,000;
b. SELECT COUNT(*) FROM employees
WHERE salary < 10000;
c. SELECT salary FROM Flag question
COUNT(employees)WHERE salary < 10000;
Question text
d. SELECT COUNT(emp_id) FROM employees
WHERE salary <= 10000; You want to display all the job position titles whose
salary is salary from 5,000 to 12,000 arrange from
Question 25 highest to lowest
Answer saved
Marked out of 1.00 Select one:
a. SELECT job_title FROM employees WHERE
salary >= 5000 AND salary <= 10000
b. SELECT employees_id, job_title FROM
employees WHERE salary >= 5000 AND salary <=
Flag question 10000
Question text
c. SELECT job_title FROM jobs WHERE salary c. SELECT last_name, hire_date FROM
>= 5000 AND salary <= 10000 employees WHERE hire_date >= TO_DATE('2000',
'YYYY') AND hire_date <= TO_DATE('2002', 'YYYY')
d. SELECT job_title FROM jobs WHERE OR salary > 5000;
min_salary >= 5000 AND max_salary<= 10000
d. SELECT last_name, hire_date FROM
Question 28 employees WHERE hire_date >= TO_DATE('Jan-
Answer saved 2000', 'Month-YYYY') AND hire_date <=
Marked out of 1.00
TO_DATE('Dec-2002', 'Month-‘YYYY') AND salary >
5,000;

Question 30
Answer saved
Marked out of 1.00
Remove flag

Question text
Display all location id between 1000 to 2000.
Select one: Flag question

a. DISPLAY location_id FROM departments Question text


WHERE location_id LING 1000 UP TO 2000
There was 10% price increase in the all the parts in
b. SELECT location_id FROM departments warehouse number 3. The Store Manager asked the
WHERE location_id IN 1000 AND 2000 Database Administrator to generate a report showing
the part number, the old and new price.
c. DISPLAY location_id FROM departments Which of the following SQL statement would satisfy
WHERE location_id BETWEEN 1000 TO 2000 the requirement of the Store Manager.
d. SELECT location_id FROM departments Select one:
WHERE location_id BETWEEN 1000 AND 2000
a. SELECT partnum, price, price * 0.1 FROM
Question 29 parts WHERE warehouse = 3
Answer saved
Marked out of 1.00 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
Flag question parts WHERE warehouse = 3
Question text
Question 31
You want to display the employee's last name and Answer saved
date hired in year 2002 whose salary is above 5000. Marked out of 1.00
Which SQL statement give the required output?
Select one:
a. SELECT last_name, hire_date FROM
employees WHERE hire_date >= TO_DATE('01-Jan- Remove flag
2000', 'DD-Mon-YYYYY') AND hire_date <=
TO_DATE('31-Dec-2002', 'DD-Mon-YYYY')AND Question text
salary ABOVE 5000;
You want to display the employee's last name and
b. SELECT last_name, hire_date FROM date hired in year 2000 to2006 whose salary is above
employees WHERE hire_date >= TO_DATE('01-Jan- 5000. Which SQL statement give the required output?
2002', 'DD-Mon-RR') AND hire_date <=
TO_DATE('31-Dec-2002', 'DD-Mon-RR') AND salary Select one:
> 5000;
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-2006', 'DD-Mon-
YYYY') AND salary ABOVE 5000;
Flag question
b. SELECT last_name, hire_date FROM Question text
employees WHERE hire_date>=
TO_DATE('01-Jan-2006', 'DD-Mon-RR') AND ANSI SQL commands cannot be abbreviated.
hire_date<= TO_DATE('31-Dec-2006', 'DD-Mon-RR')
AND salary > 5000; Select one:

c. SELECT last_name, hire_date FROM True


employees WHERE hire_date>= False
TO_DATE('Jan-2000', 'Month-YYYY') AND
hire_date<= TO_DATE('Dec-2006', 'Month-‘YYYY') Question 34
AND salary > 5,000; Answer saved
Marked out of 1.00
d. SELECT last_name, hire_date FROM
employees WHERE hire_date>=
TO_DATE('2000', 'YYYY') AND hire_date<=
TO_DATE('2006', 'YYYY') OR salary > 5000;

Question 32
Remove flag
Answer saved
Marked out of 1.00
Question text
Display the lastname of every employee in the
company. Display the output in a single column and
label it as Fullname
Format: JuanReyes
Remove flag
Select one:
Question text
a. SELECT CONCATENATE(first_name,
Which of the following SQL commands will display all last_name) AS Fullname FROM employees
the stocks on hand from 10 to 30?
b. None of the choices
Select one:
c. SELECT CONCAT(first_name, last_name)
a. SELECT * FROM parts WHERE BETWEEN FROM employees
onhand = 10 AND onhand = 30;
d. SELECT CONCAT(first_name, last_name) AS
b. SELECT * FROM parts WHERE onhand Fullname FROM employees
BETWEEN 10 to 30;
Question 35
c. SELECT * FROM onhand WHERE parts Answer saved
BETWEEN onhand = 10 AND onhand = 30; Marked out of 1.00

d. SELECT * FROM parts WHERE onhand


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

Flag question

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

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


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

Remove flag

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

a. SELECT employee_id, hire_date, Select one:


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

Question 40
Answer saved
Marked out of 1.00

Remove flag

Question text

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

Flag question

Question text Flag question

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

Question 44
Answer saved
Marked out of 1.00

Remove flag

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

Question text Question text


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

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


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

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

Question 23
d. SELECT E.employee_id, E.last_name, E.first_name, SELECT * FROM parts WHERE onhand< 20 AND
D.department_name, E.salary*12 AS "ANNUAL warehouse = 3;
SALARY", D.location_id
FROM employees E Ronnie is the stockman in the warehouse of ATR
OUTER JOIN jobs J ON E.job_id = J.job_id
Corporation. The General Manager wants to know the
OUTER JOIN departments D ON E.department_id =
D.department_id parts whose price is above 10000 and above. Which of
WHERE D.location_id = 1700 AND the following SQL command that Ronnie will run to
D.department_name = 'Finance' generate the list.
ORDER BY "ANNUAL SALARY" DESC SELECT * FROM parts WHERE price >= 10000;

Which of the following SQL command will display all


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

Which of the following SQL commands will display all


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

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


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

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

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

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

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

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

What is the SQL command to display the date of the


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

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

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

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

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

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


employee's name and the minimum and maximum LA7
salary the employee can received. Which of the
following SQL command will generate the output?
SELECT first_name, last_name, job_id, min_salary, Remove the Shareholder Services department in the
max_salary FROM employees JOIN jobs USING department table
DELETE FROM departments WHERE department_name TRUNCATE TABLE departments
= ‘Shareholder Services’
SQL command to create a marker in the current
transaction.
A new department name Training with department id SAVEPOINT
300 was created in the company. This will be managed
by a Manager with ID of 203 and will located at location Nathaniel had accidentally deleted all the records in the
id 2400. newly updated ORACLE database using the DELETE SQL
Create a SQL command to update the information in the command. What is the best solution that he can do to
department table. restore all the deleted records in the database.
INSERT INTO departments VALUES (300, 'Training', Run the ROLLBACK command
203, 2400)
----------------------------------------
Create a SQL command to add a new position Database LA8
Administrator with job id of DB_ADMIN whose salary
ranges from 10,000 to 18,000. Which of the following will grant a query privileges on
INSERT INTO jobs VALUES ('DB_ADMIN', 'Database the STUDENT table
Administrator', 10000, 18000) GRANT select ON student TO matt

Remove all Manager positions in the department table. You want to cancel the privilege of matt to add records
DELETE FROM jobs WHERE job_title LIKE from the employees table.
'%Manager%'; REVOKE insert ON employees FROM matt;
----------------------------------------
SQ7 This has the highest level of privileges for task such as
creating new users, removing users and tables and
backing up tables.
DBA
Create a SQL command to add a new position Java
Developer with job id of JAVA_DEV whose salary ranges
from 7,000 to 8,000. ----------------------------------------
INSERT INTO jobs VALUES ('JAVA_DEV', 'Java SQ8
Developer', 7000, 8000)

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

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

Which of the following describes the command below? Matt wants to change his password from 1234 to abcd.
SELECT * FROM employees WHERE department = 60 Which of the following will perform the task?
FOR UPDATE ALTER USER matt IDENTIFIED abcd;
Locks the rows in the EMPLOYEES table with
department id is 60. The DBA will create a new user name sales.
Which of the following SQL command will perform the
Which of the following will erase all records in the creation?
departments table CREATE sales ACCESS 1234
'FI_ACCOUNT';

Which of the following SQL command that the DBA will


run to provide Matt to create a table in the Oracle You want to display all the job position titles whose
Database. salary is salary from 5,000 to 12,000 arrange from
GRANT create table TO matt highest to lowest
SELECT job_title FROM jobs WHERE min_salary >=
5000 AND max_salary<= 10000
What privileges that manipulates the content of the
database objects. List all employees except for IT_PROG job id.
Object Privileges All of the choices

Austin David was transferred to Purchasing


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

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

PROG-113A / ► Week 18: Designing PL/SQL / ► Short


PROG-113A / ► Week 18: Designing PL/SQL / ►
Quiz 14
Learning Activity 14
Which of the following is the syntax to open a cursor
varial Which of the following rules is INCORRECT about
Answer: OPEN cursor_variable_name cursor variables?
FOR select_statement; Answer: None of the choices.
Which of the following is the syntax to define a REF Which of the following describes weak REF
CURSOR type? CURSOR?
Answer: TYPE ref_type_name IS REF CURSOR Answer: Associates with any query
[RETURN return_type]; Restrictive, specifies a RETURN type, associates
Weak REF CURSOR is very flexible. only with type-compatible queries are description of
Answer: True a ________________.
Evaluate the following. What will be the output? Answer: Strong REF CURSOR
DECLARE Which of the following is INCORRECT about the
SUBTYPE Accumulator IS NUMBER (4,2); guidelines for cursor design?
v_amount accumulator; Answer: Use column aliases in cursors for
v_num1 NUMBER; calculated columns fetched into records declared
v_num2 NUMBER; with %COLUMNTYPE.
v_num3 NUMBER;
This is a subset of an existing data type that may
place a constraint on its base type.
BEGIN
Answer: Subtype
v_amount := 10.50;
v_num1 := 1;
PROG-113A / ► Week 15: Long Quiz / ► Long
v_num2 := 2; Quiz 3 (30/30)
v_num3 := 3; (Correction)
v_num1 := v_amount; How do you test the output of a PL/SQL block?
v_num2 := v_num1 + v_amount; Answer: Use a predefined Oracle package and its
v_num2 := v_num2 - v_num3; procedure
dbms_output.put_line('Total is: ' || v_num2); Which of the folllowing statement describes
END; PL/SQL?
Answer: 18 Answer: PL/SQL is an Oracle proprietary,
Which of the following is the syntax to fetch from a procedural, 3GL programming language
cursor variable? Which of the following syntax to declare
Answer: FETCH cursor_variable_name INTO EXCEPTION named e_invalid_id?
variable_name1 Answer: e_invalid_id EXCEPTION;
[,variable_name2,. . .] | record_name; In PL/SQL Block Structure, which of the following
Fetch into a record when fetching from a cursor. are mandatory?
Answer: True Answer: BEGIN and END
Which of the following is the syntax to close a cursor? This is a type of cursor which is created and
Answer: CLOSE cursor_variable_name; managed internally by the Oracle server to process
SQL statements
This is a subset of an existing data type that may place a
Answer: Implicit
constraint on its base type.
PL/SQL stands for
Answer: Subtype
Answer: Procedural Language extension to SQL
Which of the following rules is INCORRECT about cursor Which of the following PL/SQL will execute
variables? successfully?
Answer: None of the choices. Answer: DECLARE
Use column aliases in cursors for calculated columns v_salary INTEGER(20);
BEGIN
SELECT salary INTO v_salary FROM employees 114;
WHERE employee_id = 150; BEGIN
END; DELETE employees WHERE employee_id =
What is the last clause in trapping exceptions? v_employee_id;
Answer: WHEN OTHERS END;
PL/SQL Provides a block structure for executable Answer: The PL/SQL will delete employee number
units of ________________. 114.
Answer: Code Which of the following does NOT describes
Evaluate the following PL/SQL. SELECT Statement in a PL/SQL.
DECLARE Answer: Queries must return only one column.
v_email VARCHAR(20); What are the three PL/SQL block types?
BEGIN Answer: Anonymous, Procedure, Function
SELECT email INTO v_email FROM What is the exception name when PL/SQL has an
EMPLOYEES WHERE email like 'D%'; internal problem
DBMS_OUTPUT.PUT_LINE ('Employees whose Answer: PROGRAM_ERROR
email address starts with letter D :' You have been tasked to update the database by
|| v_email); creating a PL/SQL to increase the salary of all IT
EXCEPTION Programmer employees by 100% of their existing
WHEN TOO_MANY_ROWS THEN salary. Which of the following will execute
DBMS_OUTPUT.PUT_LINE (' Your select successfully?
statement retrieved multiple rows.'); Answer: DECLARE
END; v_job_id employees.job_id%TYPE := 'IT_PROG';
Answer: The PL/SQL block will run successfully. BEGIN
Which of the folllowing is TRUE? UPDATE employees SET salary = salary * 2
Answer: SQL code are embedded within PL/SQL WHERE job_id = v_job_id;
statements END;
You can trap any error by including a corresponding What is the error trapping function that returns the
handler within the exception-handling section of the numeric value of the error code?
PL/SQL block. Answer: SQLCODE
Answer: True What is the exception name when single row
When an exception is user defined, the exception is SELECT returned no data.
raised ____________ . Answer: NO_DATA_FOUND
Answer: Explicitly Which of the following DOES NOT describes an
Evaluate the PL/SQL exception?
DECLARE Answer: Exception is a PL/SQL error that is raised
v_first_name VARCHAR2(50); before program execution.
v_last_name VARCHAR2(50); Evaluate the following PL/SQL.
v_salary INTEGER(20); DECLARE
BEGIN v_employee_id employees.employee_id%TYPE :=
SELECT first_name, last_name, salary INTO 114;
v_first_name, v_last_name, v_salary FROM BEGIN
employees WHERE department_id = 60; DELETE employees WHERE employee_id =
DBMS_OUTPUT.PUT_LINE('Firstname : '|| v_employee_id;
v_first_name); END;
DBMS_OUTPUT.PUT_LINE('Lastname : '|| Answer: The PL/SQL will delete employee number
v_last_name); 114.
DBMS_OUTPUT.PUT_LINE('Salary : '|| v_salary); In the DECLARE section of the PL/SQL block,
END; Answer: All of the choices
Answer: Error in Line 6. When an exception is predefined by Oracle server,
Evaluate the following PL/SQL. the exception is raised ____________ .
DECLARE Answer: Explicitly
v_employee_id employees.employee_id%TYPE := Which of the will display the Employee ID and
number of years in service with employee ID 150? Answer: Executable and exceptions section
Answer: DECLARE What is the error trapping function that returns the
v_salaryemployees.salary%TYPE := 10000; numeric value of the error code?
v_employee_idemployees.employee_id%TYPE := Answer: SQLCODE
150; What is the exception name when PL/SQL has an
v_years INTEGER(10); internal problem
BEGIN Answer: PROGRAM_ERROR
SELECT employee_id, ROUND((SYSDATE - Evaluate the following PL/SQL. At what line
hire_date) /365,0) INTO v_employee_id, v_years number is the error of the PL/SQL?
FROM employees WHERE employee_id = DECLARE
v_employee_id ; v_deptno NUMBER := 800;
DBMS_OUTPUT.PUT_LINE('Employee ID:' || e_invalid EXCEPTION;
v_employee_id); BEGIN
DBMS_OUTPUT.PUT_LINE('Number of years : ' DELETE FROM departments
|| v_years); WHERE department_id = v_deptno;
END; IF SQL % NOT_FOUND THEN
Actions are being performed when error occurs RAISE e_invalid;
during PL/SQL execution in the END IF;
Answer: EXCEPTION COMMIT;
You can use this procedure to issue user-defined EXCEPTION
error messages from stored subprograms. WHEN e_invalid THEN
Answer: RAISE_APPLICATION_ERROR DBMS_OUTPUT.PUT_LINE('No such department
id.');
END;
Answer: 7
PROG-113A / ► Week 14: Handling Exceptions / What is the last clause in trapping exceptions?
► Short Quiz 12 Answer: WHEN OTHERS
Complete the diagram in Trapping Non-Predefined
Evaluate the following PL/SQL. Oracle Server Errors.
DECLARE Answer: Declare, Associate, Reference
v_email VARCHAR(20);
BEGIN PROG-113A / ► Week 14: Handling Exceptions /
SELECT email INTO v_email FROM ► Learning Activity 12
EMPLOYEES WHERE email like 'D%';
DBMS_OUTPUT.PUT_LINE ('Employees whose You can use this procedure to issue user-defined
email address starts with letter D :' error messages from stored subprograms.
|| v_email); Answer: RAISE_APPLICATION_ERROR
EXCEPTION Which of the following syntax to declare
WHEN TOO_MANY_ROWS THEN EXCEPTION named e_invalid_id?
DBMS_OUTPUT.PUT_LINE (' Your select Answer: e_invalid_id EXCEPTION;
statement retrieved multiple rows.'); When an exception is predefined by Oracle server,
END; the exception is raised ____________ .
Answer: The PL/SQL block will run successfully. Answer: Explicitly
Which of the following DOES NOT describes an When an exception is user defined, the exception is
exception? raised ____________ .
Answer: Exception is a PL/SQL error that is raised Answer: Explicitly
before program execution. You can trap any error by including a corresponding
What is the exception name when single row handler within the exception-handling section of the
SELECT returned no data. PL/SQL block.
Answer: NO_DATA_FOUND Answer: True
RAISE_APPLICATION_ERROR is used in two
different places. These are ___________________.
PROG-113A / ► Week 13: Interacting with Oracle In the DECLARE section of the PL/SQL block
Server / ► Learning Activity 11 Answer: All of the choices
In PL/SQL Block Structure, which of the following
Which of the following does NOT describes are OPTIONAL?
SELECT Statement in a PL/SQL. Answer: None of the choices
Answer: Queries must return only one column. What are the three PL/SQL block types?
Evaluate the following PL/SQL. Answer: Anonymous, Procedure, Function
1 DECLARE How do you test the output of a PL/SQL block?
Answer: Use a predefined Oracle package and its
2 v_employee_id employees.employee_id%TYPE procedure
:= 114; You want to display the name, salary and tax of
employee #150. Which of the PL/SQL will execute
3 BEGIN successfully? Note tax is computed as 2% of the
salary.
4 DELETE employees WHERE employee_id = Answer: DECLARE
v_employee_id; v_first_name VARCHAR2(50);
v_last_name VARCHAR2(50);
5 END; v_salary INTEGER(20);
Answer: The PL/SQL will delete employee number v_tax INTEGER(10);
114. BEGIN
Which of the following PL/SQL that will display SELECT first_name, last_name, salary, salary *
the total number employees whose salary is 10000 0.02 INTO v_first_name, v_last_name, v_salary,
and above? v_tax FROM employees WHERE employee_id =
Answer: DECLARE 150;
v_salary employees.salary%TYPE := 10000; DBMS_OUTPUT.PUT_LINE('Firstname : '||
BEGIN v_first_name);
SELECT COUNT(*) INTO v_salary FROM DBMS_OUTPUT.PUT_LINE('Lastname : '||
employees WHERE salary >= v_salary; v_last_name);
DBMS_OUTPUT.PUT_LINE(v_salary); DBMS_OUTPUT.PUT_LINE('Salary : '|| v_salary);
END; DBMS_OUTPUT.PUT_LINE('Tax : '|| v_tax);
This is a type of cursor which is created and END;
managed internally by the Oracle server to process Which of the folllowing statement describes
SQL statements PL/SQL?
Answer: Implicit Answer: PL/SQL is an Oracle proprietary,
You have been tasked to update the database by procedural, 3GL programming language
creating a PL/SQL to increase the salary of all IT
Programmer employees by twice of their existing PROG-113A / ► Week 12: Introduction to PLSQL / ►
salary. Which of the following will execute Learning Activity 10
successfully? PL/SQL stands for
Answer: DECLARE Answer: Procedural Language extension to SQL
v_job_id employees.job_id%TYPE := 'IT_PROG'; PL/SQL Provides a block structure for executable units
BEGIN of ________________.
UPDATE employees SET salary = salary * 2 Answer: Code
WHERE job_id = v_job_id; In PL/SQL Block Structure, which of the following are
END; mandatory?
Answer: BEGIN and END
PROG-113A / ► Week 12: Introduction to PLSQL Which of the following PL/SQL will execute successfully?
/ ► Short Quiz 10 Answer: DECLARE
v_salary INTEGER(20);
Which of the folllowing is TRUE?
BEGIN
Answer: SQL code are embedded withing PL/SQL
SELECT salary INTO v_salary FROM employees WHERE
statements
employee_id = 150;
END;
PROG-113A / ► Week 11: Using Subqueries to Solve
Actions are being performed when error occurs during
Queries / ► Learning Activity 9
PL/SQL execution in the
Which of the following is INCORRECT?
Answer: EXCEPTION
Answer: Use single-row operators with multiple-row
subqueries
Which of the folllowing is required in a subquery?
PROG-113A / ► Week 11: Using Subqueries to Answer: SELECT
Solve Queries / ► Short Quiz 9 Which of the following is CORRECT about sub-queries?
Answer: Subquery execute before the main query
You want to display the department name the same executes.
with the location of the Purchasing department. Evaluate the SQL Command
Answer: SELECT department_name from SELECT job_id, job_title FROM jobs J WHERE INCLUDES
departments where location_id = (SELECT (SELECT * FROM employees WHERE J.job_id = e.job_id
location_id from departments where );
department_name = 'Purchasing') Answer: The SQL will return an error. Invalid
"INCLUDES" parameter.
Evaluate the SQL command
Evaluate the SQL command
SELECT employee_id, job_id, salary from
SELECT employee_id, salary from employees where
employees where salary < ALL (SELECT salary
salary = ANY (SELECT salary FROM employees WHERE
FROM employees WHERE job_id =
'FI_ACCOUNT') AND job_id = 'IT_PROG' job_id = 'IT_PROG') AND job_id = 'ST_CLERK'
Answer: This has no error. Answer: This has no error.

Question 1
You want to display all records in the database Complete
whose salary is above the salary of Alexander Mark 2.00 out of 2.00
Hunold.
Answer: SELECT * from employees WHERE
salary < (SELECT salary FROM employees
WHERE first_name = 'Alexander' AND last_name
= 'Hunold') Flag question

Evaluate the SQL command Question text


SELECT employee_id, last_name, first_name, You want to display all the job position titles whose
job_id FROM employees WHERE department_id = salary is salary from 5,000 to 12,000 arrange from
(SELECT max(department_id) FROM employees highest to lowest
GROUP BY department_id) Select one:
Answer: This will return an error. Single-row
subquery returns more than one row. a. SELECT job_title FROM jobs WHERE min_salary
>= 5000 AND max_salary<= 10000
You want to display all employee id, name, hired b. SELECT job_title FROM employees WHERE
date and salary who are hired after employee 104 salary >= 5000 AND salary <= 10000
was hired. c. SELECT employees_id, job_title FROM employees
Answer: SELECT employee_id, last_name, WHERE salary >= 5000 AND salary <= 10000
hire_date, salary FROM employees WHERE
TO_NUMBER(TO_CHAR(hire_date, 'YYYY')) > d. SELECT job_title FROM jobs WHERE salary >=
5000 AND salary <= 10000
(SELECT TO_NUMBER(TO_CHAR(hire_date,
'YYYY')) FROM employees WHERE employee_id Question 2
= 104) Complete
Mark 2.00 out of 2.00
c. The SQL command will display all records in the
database
d. No records will be displayed

Flag question Question 5


Complete
Question text Mark 2.00 out of 2.00

What is the SQL command to count the number of


records in the employees table?
Select one:
a. SELECT ALL FROM employees Flag question
b. SELECT * FROM employees; Question text
c. SELECT COUNT(*) FROM employees You want to display all the employee id and the month
an employee was hired.
d. SELECT SUM(*) FROM employees;
Which SQL statement give the required output?
Question 3 Select one:
Complete
Mark 2.00 out of 2.00 a. SELECT employee_id, hire_date,
TO_DATE(hire_date,'Month') AS "Hired Month",
job_id FROM
b. SELECT employee_id, hire_date,
MONTH(hire_date,'Month') AS "Hired Month", job_id
Flag question FROM employees

Question text c. SELECT employee_id, hire_date,


TO_CHAR(hire_date,'Month') AS "Hired Month",
True or False. The AND, OR, NOT are comparison job_id FROM employees
operators.
d. SELECT employee_id, hire_date,
Select one: TO_MONTH(hire_date,'Month') AS "Hired Month",
True job_id FROM employees

False Question 6
Complete
Mark 2.00 out of 2.00
Question 4
Complete
Mark 2.00 out of 2.00

Flag question

Flag question
Question text

Question text You want to generate the total salary per month of
every department in the company.
Evaluate the following SQL command
SELECT * FROM jobs WHERE job_title LIKE Select one:
'Manager%' a. SELECT department_id, salary FROM employees
Select one: ORDER BY SUM(salary)

a. The SQL command will produce an error. b. SELECT department_id, TOTAL(salary) FROM
employees GROUP BY department_id
b. The SQL command will display all employees with
Manager position c. SELECT department_id, salary FROM employees
GROUP BY SUM(salary) ORDER BY department_id
d. SELECT department_id, SUM(salary) FROM b. SELECT CONCATENATE(first_name, last_name)
employees GROUP BY department_id AS Fullname FROM employees

Question 7 c. SELECT CONCAT(first_name, last_name) FROM


Complete employees
Mark 2.00 out of 2.00
d. SELECT CONCAT(first_name, last_name) AS
Fullname FROM employees

Question 9
Complete
Mark 0.00 out of 2.00
Flag question

Question text
You want to display the employee's last name whose
salary is below 10,000 and whose lastname starts
with letter D. Flag question
Which SQL statement give the required output format
of the salary? Question text

Select one: Display the first 5 letter in the surname of all the
employees whose firstname starts with letter 'N'
a. SELECT last_name, TO_INT(salary,
'$999,999.99') AS "MONTHLY SALARY" FROM Select one:
employees WHERE salary < 10,000 WHERE a. SELECT SUBSTR(last_name,1,5), first_name
last_name STARTS 'D%' FROM employees WHERE first_name IN 'N'
b. SELECT last_name, TO_CHAR(salary, b. SELECT SUBSTR(last_name,1,5), first_name
'$999,999.99') AS "MONTHLY SALARY" FROM FROM employees WHERE SUBSTR(first_name,1,1)
employees WHERE salary < 10000 WHERE = 'N'
last_name LIKE 'D%'
c. SELECT SUBSTR(surname,1,5), first_name
c. SELECT last_name, TO_INTEGER(salary, FROM employees WHERE SUBSTR(first_name,1,1)
$999,999.99) AS "MONTHLY SALARY" FROM IN 'N'
employees WHERE salary < 10000 WHERE
last_name IN 'D%' d. SELECT SUBSTR(surname,1,5), first_name
FROM employees WHERE first_name = 'N'
d. SELECT last_name, TO_NUMBER(salary,
'$999,999.99') AS "MONTHLY SALARY" FROM e. SELECT SUBSTR(last_name,1,5), first_name
employees WHERE salary < 10,000 WHERE FROM employees WHERE SUBSTR(first_name,1,1)
last_name = ‘D%’ IN 'N'

Question 8 Question 10
Complete Complete
Mark 2.00 out of 2.00 Mark 2.00 out of 2.00

Flag question Flag question

Question text Question text


Display the lastname of every employee in the Austin David was transferred to Purchasing
company. Display the output in a single column and Department. You are assigned to update the
label it as Fullname database.
Format: JuanReyes Which of the following SQL command will satisfy the
requirements?
Select one:
Select one:
a. None of the choices
a. UPDATE first_name = ‘David’ AND last_name = b. The SQL command will display employees with
‘Austin’ FROM employees SET department_id = 30 department id 60 and 70.
b. UPDATE department_id = 30 WHERE first_name c. The SQL command will give an incorrect output.
= ‘David’ AND last_name = ‘Austin’
d. The SQL command will display employees with
c. UPDATE employees WHERE department_id = 30 department id 60 or 70.
SET first_name = ‘David’ AND last_name = ‘Austin’
Question 13
d. UPDATE employees SET department_id = 30 Complete
WHERE first_name = ‘David’ AND last_name = Mark 2.00 out of 2.00
‘Austin’

Question 11
Complete
Mark 2.00 out of 2.00

Flag question

Question text
You want to display the employee's last name and
Flag question
date hired in year 2000 to2006 whose salary is above
5000. Which SQL statement give the required output?
Question text
Select one:
John want to know how many employees receiving
salary below 10,000. a. SELECT last_name, hire_date FROM employees
What SQL command he need to run? WHERE hire_date>=
TO_DATE('01-Jan-2006', 'DD-Mon-RR') AND
Select one: hire_date<= TO_DATE('31-Dec-2006', 'DD-Mon-RR')
AND salary > 5000;
a. SELECT COUNT(*) FROM employees WHERE
salary < 10000; b. SELECT last_name, hire_date FROM employees
WHERE hire_date>=
b. SELECT COUNT(salary) FROM employees TO_DATE('Jan-2000', 'Month-YYYY') AND
WHERE salary < 10,000; hire_date<= TO_DATE('Dec-2006', 'Month-‘YYYY')
c. SELECT COUNT(emp_id) FROM employees AND salary > 5,000;
WHERE salary <= 10000; c. SELECT last_name, hire_date FROM employees
d. SELECT salary FROM WHERE hire_date>=
COUNT(employees)WHERE salary < 10000; TO_DATE('01-Jan-2000', 'DD-Mon-YYYYY') AND
hire_date<= TO_DATE('31-Dec-2006', 'DD-Mon-
Question 12 YYYY') AND salary ABOVE 5000;
Complete
Mark 2.00 out of 2.00 d. SELECT last_name, hire_date FROM employees
WHERE hire_date>=
TO_DATE('2000', 'YYYY') AND hire_date<=
TO_DATE('2006', 'YYYY') OR salary > 5000;

Question 14
Complete
Flag question Mark 2.00 out of 2.00
Question text
Evaluate the following SQL command
SELECT employee_id, salary, department_id FROM
employees WHERE department_id IN (60,70)
Flag question
Select one:
Question text
a. The SQL command will produce an error.
List all employees except for IT_PROG job id.
Select one:
d. SELECT * FROM employees SORT BY lastname
a. SELECT *FROM employees EXCEPT JOB_ID != ascending
'IT_PROG'
Question 17
b. SELECT *FROM employees WHERE JOB_ID Complete
NOT IN ('IT_PROG') Mark 2.00 out of 2.00

c. SELECT *FROM employees WHERE JOB_ID <>


'IT_PROG'
d. All of the choices

Question 15 Flag question


Complete
Mark 2.00 out of 2.00 Question text
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:
Flag question
a. SELECT employee_id, first_name, last_name
Question text FROM employees ORDER BY department_id
WHERE first_name LIKE 'D%' and job_id =
Evaluate the following SQL command 'IT_PROG'
SELECT employee_id, min_salary, max_salary
FROM employees, departments WHERE b. SELECT employees FROM employee_id,
salary>= 10000 && salary <= 20000 first_name, last_name WHERE first_name LIKE ‘D%’
and job_id = ‘IT_PROG’ ORDER BY department_id
Select one:
c. SELECT employee_id, first_name, last_name
a. The SQL will produce Cartesian Product FROM employees WHERE job_id = 'IT_PROG' OR
b. The SQL will display the employee id, department first_name LIKE 'D%' and ORDER BY department_id
id and the minimum and maximum salary whose d. SELECT employee_id, first_name, last_name
salary is between 10000 and 20000. FROM employees WHERE first_name LIKE 'D%' and
c. The SQL command will produce an error. job_id = 'IT_PROG' ORDER BY department_id

d. The SQL command will give an incorrect output. Question 18


Complete
Question 16 Mark 2.00 out of 2.00
Complete
Mark 2.00 out of 2.00

Flag question

Flag question
Question text

Question text You what to generate the average salary of all


employees whose job function is FI_ACCOUNT.
Display all the records in the employee table. Arrange Which of the following SQL command will produce the
the output in by lastname from A-Z order. output.
Select one: Select one:
a. SELECT * FROM employees SORT BY lastname a. SELECT AVERAGE(salary) FROM employees
WHERE job_id = 'FI_ACCOUNT';
b. SELECT * FROM employees ORDER BY
lastname b. SELECT AVG(salary) FROM employees WHERE
job_id = 'FI_ACCOUNT';
c. SELECT * FROM employees ORDER BY lastname
AZ
c. SELECT AVE(salary) FROM employees WHERE d. SELECT employee_id, salary FROM employees
job_id = 'FI_ACCOUNT'; WHERE salary)
d. SELECT COUNT AVG(salary) FROM employees e. SELECT employee_id, salary, salary * .30 FROM
WHERE job_id = 'FI_ACCOUNT'; employees

Question 19 Question 21
Complete Complete
Mark 2.00 out of 2.00 Mark 2.00 out of 2.00

Flag question Flag question

Question text Question text


Display all location id between 1000 to 2000. Display the employee id, salary, number of years and
the hiring date of every employee in the company.
Select one:
Select one:
a. DISPLAY location_id FROM departments WHERE
location_id LING 1000 UP TO 2000 a. SELECT employee_id,salary, hire_date, hire_date-
SYSDATE /365 FROM employees;
b. DISPLAY location_id FROM departments WHERE
location_id BETWEEN 1000 TO 2000 b. SELECT employee_id, salary, hire_date,
ROUND((SYSDATE - hire_date) /365,0) FROM
c. SELECT location_id FROM departments WHERE employees;
location_id IN 1000 AND 2000
c. SELECT employee_id, salary, hire_date, hire_date
d. SELECT location_id FROM departments WHERE /365 FROM employees;
location_id BETWEEN 1000 AND 2000
Question 22
Question 20 Complete
Complete Mark 2.00 out of 2.00
Mark 2.00 out of 2.00

Flag question
Flag question
Question text
Question text
Display the employee's name, job title, job_id and the
What will be the SQL command if every employee will department name of employees with department id of
be given a productivity bonus which is equivalent to 100.
3% of the monthly salary?
Display the employee id, salary and the productivity Select one:
bonus.
a. SELECT E.employee_id, J.job_title, e.job_id,
Select one: D.department_name
FROM employees E
a. SELECT employee_id, salary, salary + (salary .03) JOIN jobs J ON E.job_id = J.job_id
FROM employees JOIN departments D ON E.department_id =
b. SELECT employee_id, salary, salary * .03 FROM D.department_id
employees WHERE E.department_id = 100

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

Flag question

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


Display employee id, lastname, firstname, department 10: Quarterly Examination / ► First Quarter
name, annual salary, location id of employees whose Exam
location id is 1700 and working in Finance
Department. Label the annual salary to ANNUAL Question 1
SALARY. Answer saved
Sort the output in from highest to lowest salary. (4 Marked out of 1.00
POINTS) Remove flag
Question text Select one:
a. SELECT employee_id, salary, salary * .03 FROM
You can relate data to multiple tables using a foreign employees
key. b. SELECT employee_id, salary, salary * .30 FROM
Select one: employees
True c. SELECT employee_id, salary, salary * 1.03 FROM
False employees
d. SELECT employee_id, salary, salary + (salary .03)
Question 2 FROM employees
Answer saved e. SELECT employee_id, salary FROM employees
Marked out of 1.00 WHERE salary)
Remove flag
Question 5
Question text
Answer saved
Which of the following SELECT statement is the Marked out of 1.00
Flag question
correct report that will deduct 5 from ONHAND,
multiply 5 in WAREHOUSE, after getting the value on Question text
both ONHAND and WAREHOUSE add their data: as
shown below: ONHAND - 5 + 5 * WAREHOUSE You want to display the employee’s last name
Note that you have to force the Oracle to prioritize first whose salary is below 10,000 and whose lastname
the Subtraction over Multiplication. List only the starts with letter K.
column DESCRIPTION, ONHAND and
Which SQL statement give the required output
WAREHOUSE.
format of the salary?
Select one:
a. SELECT (ONHAND-5) + 5(* WAREHOUSE), Select one:
DESCRIPTION FROM PARTS; a. SELECT last_name, TO_CHAR(salary,
b. SELECT ONHAND-5 + 5 * WAREHOUSE, '$999,999.99') AS "MONTHLY SALARY" FROM
DESCRIPTION FROM PARTS; employees WHERE salary < 10000WHERE
c. SELECT (ONHAND-5) + 5 * WAREHOUSE, last_name LIKE ‘K%’
DESCRIPTION FROM PARTS; b. SELECT last_name, TO_NUMBER(salary,
d. SELECT ONHAND-5 + 5 (* WAREHOUSE), '$999,999.99') AS "MONTHLY SALARY" FROM
DESCRIPTION FROM PARTS; employees WHERE salary < 10,000WHERE
last_name = ‘K%’
Question 3 c. SELECT last_name, TO_INTEGER(salary,
Answer saved $999,999.99) AS "MONTHLY SALARY" FROM
Marked out of 1.00 employees WHERE salary < 10000 WHERE
Flag question
last_name IN 'K%'
Question text d. SELECT last_name, TO_INT(salary, '$999,999.99')
AS "MONTHLY SALARY" FROM employees WHERE
INSERT, DELETE, UPDATE are ________________ salary < 10,000 WHERE last_name STARTS 'K%'
commands
Question 6
Select one: Answer saved
a. DCL Marked out of 1.00
b. DML Remove flag
c. DDL
Question text
d. All of the choices
Which of the following is the correct report that will
Question 4 display the CLASS from table PARTS.
Answer saved
Marked out of 1.00 Select one:
Flag question
a. SELECT * CLASS FROM PARTS;
Question text b. SELECT CLASS AS CLASS FROM PARTS;
c. SELECT 'CLASS' FROM PARTS;
What will be the SQL command if every employee will d. SELECT CLASS FROM PARTS;
be given a productivity bonus which is equivalent to
3% of the monthly salary? Question 7
Display the employee id, salary and the productivity Answer saved
bonus. Marked out of 1.00
Remove flag
Question text You want to display the employee's last name whose
salary is below 10,000 and whose lastname starts
Evaluate the following SQL command with letter D.
SELECT employee_id, salary, department_id FROM Which SQL statement give the required output format
employees WHERE department_id IN (60,70) of the salary?
Select one: Select one:
a. The SQL command will display employees with a. SELECT last_name, TO_INTEGER(salary,
department id 60 or 70. $999,999.99) AS "MONTHLY SALARY" FROM
b. The SQL command will give an incorrect output. employees WHERE salary < 10000 WHERE
c. The SQL command will produce an error. last_name IN 'D%'
d. The SQL command will display employees with b. SELECT last_name, TO_INT(salary, '$999,999.99')
department id 60 and 70. AS "MONTHLY SALARY" FROM employees WHERE
salary < 10,000 WHERE last_name STARTS 'D%'
Question 8
Answer saved
c. SELECT last_name, TO_CHAR(salary,
Marked out of 1.00 '$999,999.99') AS "MONTHLY SALARY" FROM
Remove flag employees WHERE salary < 10000 WHERE
last_name LIKE 'D%'
Question text d. SELECT last_name, TO_NUMBER(salary,
You what to generate the average salary of all '$999,999.99') AS "MONTHLY SALARY" FROM
employees whose job function is FI_ACCOUNT. employees WHERE salary < 10,000 WHERE
Which of the following SQL command will produce the last_name = ‘D%’
output.
Question 11
Select one: Answer saved
a. SELECT AVG(salary) FROM employees WHERE Marked out of 1.00
Flag question
job_id = 'FI_ACCOUNT';
b. SELECT AVE(salary) FROM employees WHERE Question text
job_id = 'FI_ACCOUNT';
c. SELECT AVERAGE(salary) FROM employees Which of the following will is the correct command to
WHERE job_id = 'FI_ACCOUNT'; create a role.
d. SELECT COUNT AVG(salary) FROM employees Select one:
WHERE job_id = 'FI_ACCOUNT'; a. CREATE ROLE gen_manager
b. None of the choices
Question 9
Answer saved
c. GRANT ROLE gen_manager
Marked out of 1.00 d. CREATE gen_manager ROLE
Remove flag
Question 12
Question text Answer saved
Marked out of 1.00
Evaluate the following SQL command Flag question
SELECT employee_id, min_salary, max_salary
FROM employees, departments WHERE Question text
salary>= 10000 && salary <= 20000 What is the SQL command to display the date of the
Select one: first employee that was hired?
a. The SQL will produce Cartesian Product Select one:
b. The SQL will display the employee id, department a. SELECT FIRST(hire_date) FROM employees;
id and the minimum and maximum salary whose b. SELECT hire_date FROM employees WHERE
salary is between 10000 and 20000. TO_CHAR(hire_date) = ‘FIRST’;
c. The SQL command will give an incorrect output. c. SELECT MIN(hire_date) FROM employees;
d. The SQL command will produce an error. d. SELECT hire_date FROM employees WHERE
FIRST(hire_date );
Question 10
Answer saved
Marked out of 1.00 Question 13
Flag question Answer saved
Marked out of 1.00
Question text Flag question

Question text
You want to display the employee id and the year TRUE OR FALSE.
when an employee was hired. A FOREIGN KEY is a field in one table that refers to
Which SQL statement give the required output? the PRIMARY KEY in another table.
Select one: Select one:
a. SELECT employee_id, YEAR(hire_date,'YYYY') True
FROM employees; False
b. SELECT employee_id, YEAR(hire_date') FROM
employees; Question 17
c. SELECT employee_id, Answer saved
Marked out of 1.00
TO_YEAR(hire_date,'YYYY') FROM employees; Flag question
d. SELECT employee_id,
TO_CHAR(hire_date,'YYYY') FROM employees; Question text

Question 14 INDEX is an example of _____________________


Answer saved privilege.
Marked out of 1.00
Remove flag Select one:
a. System
Question text b. None of the choices
Evaluate the following SQL command c. Object
SELECT employee_id, hire_date, department_name d. Data
FROM employees, departments
Question 18
WHERE departments.department_id = Answer saved
employees.department_id Marked out of 1.00
Flag question
Select one:
a. The SQL command will produce an error. Question text
b. The SQL command will give an incorrect output.
c. The SQL command should have ALIAS for the Ms. Ella what to generate the average salary of all
table to produce a correct output. employees whose job function is IT_PROG.
d. The SQL command will produce a correct output. Which of the following SQL command will produce the
output.
Question 15
Select one:
Answer saved
Marked out of 1.00 a. SELECT AVERAGE(salary) FROM employees
Remove flag WHERE job_id = 'IT_PROG';
b. SELECT AVE(salary) FROM employees WHERE
Question text job_id = 'IT_PROG';
Display all the records whose stock is below 20 and in c. SELECT AVG(salary) FROM employees WHERE
warehouse number 3. job_id = 'IT_PROG';
d. SELECT COUNT AVG(salary) FROM employees
Select one: WHERE job_id = 'IT_PROG';
a. SELECT * FROM parts WHERE onhand< 20 OR
warehouse = 3; Question 19
b. SELECT * FROM parts WHERE onhand> 20 OR Answer saved
Marked out of 1.00
warehouse = 3; Flag question
c. SELECT * FROM parts WHERE onhand< 20 AND
warehouse = 3; Question text
d. SELECT * FROM parts WHERE onhand<= 20 AND
warehouse = 3; A _______________ consists of a collection of DML
e. SELECT ALL FROM parts WHERE onhand< 20 statements that form a logical unit of work.
AND warehouse = 3; Select one:
f. SELECT ALL FROM parts WHERE onhand<= 20 a. All of the choices
AND warehouse = 3; b. Transaction
c. SQL command
Question 16
d. Database
Answer saved
Marked out of 1.00
Flag question Question 20
Answer saved
Question text Marked out of 1.00
Remove flag and total outstanding balance on hand of every class
in warehouse number 1&2.
Question text
Which of the following SQL command will generate
Which of the following SELECT statement is the the required output.
correct PL/SQL that will display all rows and
columns? Select one:
a. SELECT warehouse, class, count(partnum),
Select one: sum(onhand) GROUP BY warehouse,class HAVING
a. SELECT TABLE PARTS; warehouse = 1 or warehouse = 2 FROM parts;
b. SELECT FROM TABLE PARTS; b. SELECT warehouse, class, count(partnum),
c. SELECT * FROM PARTS; sum(onhand) GROUP BY warehouse,class WHERE
d. SELECT ALL FROM PARTS; warehouse = 1 or warehouse = 2 FROM parts;
c. SELECT warehouse, class, SUM(partnum),
Question 21 SUM(onhand) FROM parts GROUP BY
Answer saved warehouse,class HAVING warehouse = 1 AND
Marked out of 1.00 warehouse = 2;
Remove flag
d. SELECT warehouse, class, COUNT(partnum),
Question text SUM(onhand) FROM parts GROUP BY
warehouse,class HAVING warehouse = 1 OR
Display all the records in the employee table. Arrange warehouse = 2;
the output in by lastname from A-Z order.
Question 24
Select one: Answer saved
a. SELECT * FROM employees SORT BY lastname Marked out of 1.00
b. SELECT * FROM employees ORDER BY lastname Flag question
AZ
c. SELECT * FROM employees ORDER BY lastname Question text
d. SELECT * FROM employees SORT BY lastname John want to know how many employees receiving
ascending salary below 10,000.
What SQL command he need to run?
Question 22
Answer saved Select one:
Marked out of 1.00 a. SELECT COUNT(salary) FROM employees
Flag question
WHERE salary < 10,000;
Question text b. SELECT COUNT(*) FROM employees WHERE
salary < 10000;
Austin David was transferred to Purchasing c. SELECT salary FROM
Department. You are assigned to update the COUNT(employees)WHERE salary < 10000;
database. d. SELECT COUNT(emp_id) FROM employees
Which of the following SQL command will satisfy the WHERE salary <= 10000;
requirements?
Question 25
Select one: Answer saved
a. UPDATE first_name = ‘David’ AND last_name = Marked out of 1.00
‘Austin’ FROM employees SET department_id = 30 Flag question
b. UPDATE employees SET department_id = 30
WHERE first_name = ‘David’ AND last_name = Question text
‘Austin’ What privileges that manipulates the content of the
c. UPDATE department_id = 30 WHERE first_name = database objects.
‘David’ AND last_name = ‘Austin’
d. UPDATE employees WHERE department_id = 30 Select one:
SET first_name = ‘David’ AND last_name = ‘Austin’ a. Object Privileges
b. Connection Privileges
Question 23 c. Network Privileges
Answer saved d. System Privileges
Marked out of 1.00
Flag question
Question 26
Question text Answer saved
Marked out of 1.00
The General Manager request to the Database Remove flag
Administrator to generate the total number of parts Question text
Each row of data in a table can be uniquely identified Mon-YYYYY') AND hire_date <= TO_DATE('31-Dec-
by a 2002', 'DD-Mon-YYYY')AND salary ABOVE 5000;
b. SELECT last_name, hire_date FROM employees
Select one: WHERE hire_date >= TO_DATE('01-Jan-2002', 'DD-
a. foreign key Mon-RR') AND hire_date <= TO_DATE('31-Dec-
b. primary key 2002', 'DD-Mon-RR') AND salary > 5000;
c. local key c. SELECT last_name, hire_date FROM employees
d. relational key WHERE hire_date >= TO_DATE('2000', 'YYYY') AND
e. index key hire_date <= TO_DATE('2002', 'YYYY') OR salary >
5000;
Question 27
Answer saved
d. SELECT last_name, hire_date FROM employees
Marked out of 1.00 WHERE hire_date >= TO_DATE('Jan-2000', 'Month-
Flag question YYYY') AND hire_date <= TO_DATE('Dec-2002',
'Month-‘YYYY') AND salary > 5,000;
Question text
Question 30
You want to display all the job position titles whose
Answer saved
salary is salary from 5,000 to 12,000 arrange from Marked out of 1.00
highest to lowest Flag question

Select one: Question text


a. SELECT job_title FROM employees WHERE
salary >= 5000 AND salary <= 10000 There was 10% price increase in the all the parts in
b. SELECT employees_id, job_title FROM employees warehouse number 3. The Store Manager asked the
WHERE salary >= 5000 AND salary <= 10000 Database Administrator to generate a report showing
c. SELECT job_title FROM jobs WHERE salary >= the part number, the old and new price.
5000 AND salary <= 10000 Which of the following SQL statement would satisfy
d. SELECT job_title FROM jobs WHERE min_salary the requirement of the Store Manager.
>= 5000 AND max_salary<= 10000 Select one:
a. SELECT partnum, price, price * 0.1 FROM parts
Question 28
Answer saved
WHERE warehouse = 3
Marked out of 1.00 b. SELECT partnum, price, price * 10% FROM parts
Remove flag WHERE warehouse = 3
c. SELECT partnum, price, price * 1.1 FROM parts
Question text WHERE warehouse = 3
Display all location id between 1000 to 2000. d. SELECT partnum, price, price * 1.10% FROM parts
WHERE warehouse = 3
Select one:
a. DISPLAY location_id FROM departments WHERE Question 31
location_id LING 1000 UP TO 2000 Answer saved
Marked out of 1.00
b. SELECT location_id FROM departments WHERE Remove flag
location_id IN 1000 AND 2000
c. DISPLAY location_id FROM departments WHERE Question text
location_id BETWEEN 1000 TO 2000
d. SELECT location_id FROM departments WHERE You want to display the employee's last name and
location_id BETWEEN 1000 AND 2000 date hired in year 2000 to2006 whose salary is above
5000. Which SQL statement give the required output?
Question 29
Answer saved
Select one:
Marked out of 1.00 a. SELECT last_name, hire_date FROM employees
Flag question WHERE hire_date>=
TO_DATE('01-Jan-2000', 'DD-Mon-YYYYY') AND
Question text hire_date<= TO_DATE('31-Dec-2006', 'DD-Mon-
You want to display the employee's last name and YYYY') AND salary ABOVE 5000;
date hired in year 2002 whose salary is above 5000. b. SELECT last_name, hire_date FROM employees
Which SQL statement give the required output? WHERE hire_date>=
TO_DATE('01-Jan-2006', 'DD-Mon-RR') AND
Select one: hire_date<= TO_DATE('31-Dec-2006', 'DD-Mon-RR')
a. SELECT last_name, hire_date FROM employees AND salary > 5000;
WHERE hire_date >= TO_DATE('01-Jan-2000', 'DD- c. SELECT last_name, hire_date FROM employees
WHERE hire_date>=
TO_DATE('Jan-2000', 'Month-YYYY') AND Question 35
hire_date<= TO_DATE('Dec-2006', 'Month-‘YYYY') Answer saved
AND salary > 5,000; Marked out of 1.00
d. SELECT last_name, hire_date FROM employees Remove flag
WHERE hire_date>= Question text
TO_DATE('2000', 'YYYY') AND hire_date<=
TO_DATE('2006', 'YYYY') OR salary > 5000; Evaluate the following SQL command
SELECT * FROM jobs WHERE job_title LIKE
Question 32 'Manager%'
Answer saved
Marked out of 1.00 Select one:
Remove flag a. The SQL command will display all records in the
Question text database
b. The SQL command will display all employees with
Which of the following SQL commands will display all Manager position
the stocks on hand from 10 to 30? c. No records will be displayed
d. The SQL command will produce an error.
Select one:
a. SELECT * FROM parts WHERE BETWEEN Question 36
onhand = 10 AND onhand = 30; Answer saved
b. SELECT * FROM parts WHERE onhand Marked out of 1.00
BETWEEN 10 to 30; Flag question
c. SELECT * FROM onhand WHERE parts Question text
BETWEEN onhand = 10 AND onhand = 30;
d. SELECT * FROM parts WHERE onhand Aldrin wants to know the highest salary in every
BETWEEN 10 AND 30; department. Which of the following SQL command will
e. SELECT * FROM parts WHERE BETWEEN display the required output?
onhand>=10 to onhand<=30;
Select one:
Question 33 a. SELECT department_id, HIGH(salary) FROM
Answer saved employees GROUP BY department_id AND salary;
Marked out of 1.00 b. SELECT department_id, HIGHEST(salary) FROM
Flag question employees GROUP BY salary;
Question text c. SELECT department_id, MAX(salary) FROM
employees GROUP BY department_id
ANSI SQL commands cannot be abbreviated. d. SELECT department_id, MAXIMUM(salary) FROM
employees GROUP BY department_id;
Select one:
True Question 37
False Answer saved
Marked out of 1.00
Question 34 Remove flag
Answer saved
Marked out of 1.00 Question text
Remove flag
You want to display all the employee id and the month
Question text an employee was hired.
Which SQL statement give the required output?
Display the lastname of every employee in the
company. Display the output in a single column and Select one:
label it as Fullname a. SELECT employee_id, hire_date,
Format: JuanReyes TO_MONTH(hire_date,'Month') AS "Hired Month",
job_id FROM employees
Select one: b. SELECT employee_id, hire_date,
a. SELECT CONCATENATE(first_name, last_name) TO_DATE(hire_date,'Month') AS "Hired Month",
AS Fullname FROM employees job_id FROM
b. None of the choices c. SELECT employee_id, hire_date,
c. SELECT CONCAT(first_name, last_name) FROM MONTH(hire_date,'Month') AS "Hired Month", job_id
employees FROM employees
d. SELECT CONCAT(first_name, last_name) AS d. SELECT employee_id, hire_date,
Fullname FROM employees TO_CHAR(hire_date,'Month') AS "Hired Month",
job_id FROM employees
Marked out of 1.00
Question 38
Flag question
Answer saved
Marked out of 1.00
Flag question
Question text

Question text Which of the following SQL command will display the
summary table showing the total quantity on hand per
Which of the following describes the command class.
below?
SELECT * FROM employees WHERE department = Select one:
60 FOR UPDATE a. SELECT class, TOTAL(onhand) AS "QTY ON
HAND" FROM parts GROUP BY class, onhand
Select one: b. SELECT class, onhand AS "QTY ON HAND"
a. Locks the rows in the EMPLOYEES table with FROM parts GROUP BY sum(onhand)
department id is 60. c. SELECT class, sum(onhand) AS "QTY ON HAND"
b. Unlock all records with department id = 60 FROM parts GROUP BY onhand
c. All users accessing the department id 60 can d. SELECT class, sum(onhand) AS "QTY ON HAND"
accept UPDATE command simultaneously. FROM parts GROUP BY class
d. Creates a temporary table with department = 60
Question 42
Question 39 Answer saved
Answer saved Marked out of 1.00
Marked out of 1.00 Remove flag
Flag question
Question text
Question text
Display the first 5 letter in the surname of all the
Display the employee id, number of years and the employees whose firstname starts with letter 'N'
hiring date of every employee in the company.
Select one:
Select one: a. SELECT SUBSTR(last_name,1,5), first_name
a. SELECT employee_id, hire_date, FROM employees WHERE SUBSTR(first_name,1,1)
ROUND((SYSDATE - hire_date),0 /365,0) FROM IN 'N'
employees; b. SELECT SUBSTR(last_name,1,5), first_name
b. SELECT employee_id, hire_date, FROM employees WHERE SUBSTR(first_name,1,1)
ROUND((SYSDATE - hire_date) /365,0) FROM = 'N'
employees; c. SELECT SUBSTR(surname,1,5), first_name FROM
c. SELECT employee_id, hire_date, hire_date /365 employees WHERE first_name = 'N'
FROM employees; d. SELECT SUBSTR(surname,1,5), first_name
d. SELECT employee_id, hire_date, hire_date- FROM employees WHERE SUBSTR(first_name,1,1)
SYSDATE /365 FROM employees; IN 'N'
e. SELECT SUBSTR(last_name,1,5), first_name
Question 40 FROM employees WHERE first_name IN 'N'
Answer saved
Marked out of 1.00 Question 43
Flag question Answer saved
Marked out of 1.00
Question text Flag question
The DBA will create a new user name sales. Question text
Which of the following SQL command will perform the
creation? Display the employee id, salary, number of years and
the hiring date of every employee in the company.
Select one:
a. CREATE USER FR0M DB_USER SET Select one:
user=’sales’ password=NULL a. SELECT employee_id,salary, hire_date, hire_date-
b. None of the choices SYSDATE /365 FROM employees;
c. CREATE USERNAME sales SET PASSWORD b. SELECT employee_id, salary, hire_date, hire_date
default /365 FROM employees;
d. CREATE sales ACCESS 1234 c. SELECT employee_id, salary, hire_date,
e. CREATE USER sales IDENTIFIED BY 1234 ROUND((SYSDATE - hire_date) /365,0) FROM
employees;
Question 41
Answer saved Question 44
Answer saved WHERE first_name LIKE 'D%' and job_id =
Marked out of 1.00 'IT_PROG'
Flag question
d. SELECT employee_id, first_name, last_name
Question text FROM employees WHERE first_name LIKE 'D%' and
job_id = 'IT_PROG' ORDER BY department_id
True or False. The AND, OR, NOT are comparison
operators. Question 47
Answer saved
Select one: Marked out of 1.00
True Flag question
False
Question text
Question 45
TRUE OR FALSE.
Answer saved
Marked out of 1.00 An owner has all the privileges on the object.
Flag question
Select one:
Question text True
False
You want to display all the employee id and the month
an employee was hired excluding employees whose Question 48
job id is AD_VP. Which SQL statement give the Answer saved
required output? Marked out of 1.00
Flag question
Select one:
Question text
a. SELECT employee_id, hire_date,
MONTH(hire_date,'Month') AS "Hired Month", You want to generate the total salary per month of
job_id FROM employees WHERE job_id EXCLUDE every department in the company.
('AD_VP'); Select one:
b. SELECT employee_id, hire_date, a. SELECT department_id, SUM(salary) FROM
TO_CHAR(hire_date,'Month') AS "Hired Month", employees GROUP BY department_id
job_id FROM employees WHERE job_id NOT IN b. SELECT department_id, salary FROM employees
('AD_VP'); ORDER BY SUM(salary)
c. SELECT employee_id, hire_date, c. SELECT department_id, salary FROM employees
TO_MONTH(hire_date,'Month') AS "Hired Month", GROUP BY SUM(salary) ORDER BY department_id
job_id FROM employees WHERE job_id NOT d. SELECT department_id, TOTAL(salary) FROM
('AD_VP'); employees GROUP BY department_id
d. SELECT employee_id, hire_date,
TO_DATE(hire_date,'Month') AS "Hired Month", Question 49
job_id FROM employees WHERE job_id NOT = Answer saved
Marked out of 1.00
'AD_VP'; Flag question

Question 46 Question text


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

Mark 1.00 out of 1.00

BL-PROG-3114-LAB-1922S
PROGG(ORACLE DATABASE) NCIIIP2
Flag question

 Dashboard Question text


 My courses
 BL-PROG-3114-LAB-1922S Display the part number whose class is not HW,
 Week 3: Use of Single Row Functions AG or SG.
 Learning Activity 1
Select one:
Started on Thursday, 19 December 2019, 3:21 PM
a. SELECT partnum FROM parts WHERE class
State Finished NOT IN ('HW', 'AG', SG')
Completed on Thursday, 19 December 2019, 3:28 PM
b. SELECT partnum FROM parts WHERE NOT IN
Time taken 6 mins 27 secs class ('HW', 'AG', SG')
Grade 6.00 out of 10.00 (60%)
c. SELECT partnum FROM parts WHERE class
Question 1 NOT IN = (‘HW’, AG’, SG’)
Incorrect

Mark 0.00 out of 1.00 d. None of the choices

Question 3
Incorrect

Mark 0.00 out of 1.00

Flag question

Question text

SQL stands for Flag question

Select one: Question text

a. Standard Question Language


Create an SQL command to display the name of a. SELECT LASTDAY(hire_date), hire_date FROM
the parts, warehouse number, price and the employees;
available stock on hand whose price is below 500.
Arrange the list by warehouse number and by b. SELECT LAST(hire_date), hire_date FROM
class. employees;
Select one:
c. SELECT LAST_DAY(hire_date), hire_date FROM
a. SELECT partnum, description, warehouse, employees;
onhand, price FROM parts ORDER BY warehouse,
d. SELECT LDAY(hire_date), hire_date FROM
class WHERE price < 500;
employees;
b. SELECT partnum, description, warehouse, Question 5
onhand, price WHERE price < 500 ORDER BY Incorrect
warehouse, class FROM parts Mark 0.00 out of 1.00

c. SELECT partnum, description, warehouse,


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

d. SELECT partnum, description, warehouse, Question text


onhand, price FROM parts ORDER BY warehouse,
class WHERE 500 < price; 1. The two development environments of Oracle
are _______________ and ______________.
e. SELECT partnum, description, warehouse,
onhand, price FROM parts WHERE price < 500
ORDER BY warehouse, class;
Select one:
Question 4
Correct a. Oracle SQL Developer; ANSI SQL Web
Mark 1.00 out of 1.00
b. Oracle DB; SQL command line

c. Oracle SQL Developer; SQL command line

d. ANSI SQL Web; Oracle Net SQL


Flag question
Feedback
Question text
Your answer is incorrect.
Display the last day of the month and the hiring
date when the employees are hired in the Question 6
Correct
company.
Mark 1.00 out of 1.00
Select one:
c. SELECT ALL FROM parts WHERE IN class =
(‘HW’, ‘AP’);

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


Flag question
'AP');
Question text
e. SELECT * FROM parts WHERE IN (class = ‘HW’,
Display the first 3 letter in the first name of all the class= ‘AP’);
employees.
Question 8
Select one: Correct

Mark 1.00 out of 1.00


a. SELECT SUBSTRING(first_name,1,3) FROM
employees;

b. SELECT SUBSTRING(first_name,1,3) FROM


employees;
Flag question

c. SELECT SUBSTR(first_name,3) FROM Question text


employees;
Display all employees whose job id contains the
d. SELECT SUBSTR(first_name,1,3) FROM word 'ACCOUNT'.
employees;
Select one:
Question 7
Correct a. SELECT * FROM EMPLOYEES WHERE job_id
Mark 1.00 out of 1.00 LIKE '%ACCOUNT%';

b. SELECT * FROM EMPLOYEES WHERE job_id


LIKE '*ACCOUNT%';

c. SELECT * FROM EMPLOYEES WHERE job_id


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

Mark 1.00 out of 1.00


b. SELECT ALL FROM class WHERE parts IN =
(‘HW’, ‘AP’);
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?
Flag question
Select one:
Question text
a. SELECT DESCRIPTION RENAME AS TITLE,
Display employee's name and id whose firstname
PARTNUM RENAME AS ID, ONHAND RENAME
starts with letter D and job id is SA_REP. Sort the
AS STOCK FROM PARTS;
output by department.

Select one: b. SELECT DESCRIPTION AS 'TITLE', PARTNUM AS


'ID', ONHAND AS 'STOCK' FROM PARTS;
a. SELECT employees FROM employee_id,
first_name, last_name WHERE first_name LIKE c. SELECT DESCRIPTION AS TITLE, PARTNUM AS
‘D%’ and job_id = ‘IT_PROG’ ORDER BY ID, ONHAND AS STOCK FROM PART;
department_id
d. SELECT DESCRIPTION NEW AS TITLE,
b. SELECT employee_id, first_name, last_name PARTNUM NEW AS ID, ONHAND NEW AS STOCK
FROM employees WHERE job_id = 'IT_PROG' OR FROM PARTS;
first_name LIKE 'D%' and ORDER BY
department_id
BL-PROG-3114-LAB-1922S
c. SELECT employee_id, first_name, last_name PROGG(ORACLE DATABASE) NCIIIP2
FROM employees WHERE first_name LIKE 'D%'
and job_id = 'IT_PROG' ORDER BY department_id
 Dashboard
 My courses
d. 'IT_PROG' OR first_name LIKE 'D%' and ORDER
 BL-PROG-3114-LAB-1922S
BY department_id  Week 3: Use of Single Row Functions
 Learning Activity 1
e. SELECT employee_id, first_name, last_name
FROM employees ORDER BY department_id Started on Thursday, 19 December 2019, 3:30
WHERE first_name LIKE 'D%' and job_id =
'IT_PROG' State Finished

Question 10 Completed on Thursday, 19 December 2019, 3:32


Incorrect
Time taken 2 mins 22 secs
Mark 0.00 out of 1.00
Grade 8.00 out of 10.00 (80%)

Question 1
Correct

Mark 1.00 out of 1.00


Flag question

Question text
b. SELECT * FROM parts WHERE BETWEEN
onhand>=10 to onhand<=30;

c. SELECT * FROM parts WHERE onhand


Flag question
BETWEEN 10 AND 30;
Question text
d. SELECT * FROM onhand WHERE parts
List all the employee_id of all employees whose BETWEEN onhand = 10 AND onhand = 30;
salary is 5000 and below and belong to
department 60 or 100. e. SELECT * FROM parts WHERE BETWEEN
onhand = 10 AND onhand = 30;
Select one:
Question 3
a. SELECT employee_id,salary, department_id Correct
FROM employees WHERE salary < 5000 AND Mark 1.00 out of 1.00
department_id IN (60,100)

b. SELECT employees FROM employee_id,salary,


department_idWHERE salary < 5000 AND
department_id IN (60,100)
Flag question

c. SELECT employee_id FROM employee WHERE Question text


salary < 5000 AND department_id IN ('60,'100')
Display the total number of characters of the last
d. SELECT employee_id,salary, department_id name of all the employees.
FROM employees WHERE salary < 5000 AND
Select one:
department_id IN (60 OR 100)

Question 2 a. SELECT LEN(last_name) FROM employees;


Correct
b. SELECT LENGTH(last_name) FROM employees;
Mark 1.00 out of 1.00

c. SELECT TOTAL(last_name) FROM employees;

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

Mark 1.00 out of 1.00


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

Select one:

a. SELECT * FROM parts WHERE onhand Flag question


BETWEEN 10 to 30;
Question text
Display the name, jobs id and salary of the all the True
employees whose department id is 100 and
salary is below 8000. Arrange the output by False
salary in ascending order.
Question 6
Select one: Correct

Mark 1.00 out of 1.00


a. SELECT name, salary FROM employees WHERE
department_id = 100 AND salary < 8000 ORDER
BY salary ASC

b. SELECT first_name, last_name, salary FROM


Flag question
employees ORDER BY salary WHERE
department_id = 100 AND salary > 8000 Question text

c. SELECT first_name, last_name, salary FROM Every employee will get a bonus of 150% of
employees WHERE salary < 8000 AND his/her current salary. Display the employee id,
department_id = 100 AND ORDER BY salary and the bonus of every employee. Label
department_id the computed bonus with Bonus

Select one:
d. SELECT first_name, last_name, salary FROM
employees WHERE department_id = 100 AND
a. SELECT employee_id, salary, salary * 1.5 AS
salary < 8000 ORDER BY salary
Bonus FROM employees

e. SELECT name FROM employees WHERE salary


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

Mark 1.00 out of 1.00

Flag question

Question text Flag question

Question text
Using Data Manipulation Language, you can ADD
columns in the table. Ronnie is the stockman in the warehouse of ATR
Select one: Corporation. The General Manager wants to
know the parts whose price is above 10000 and f. SELECT ALL FROM parts ORDER BY price
above. Which of the following SQL command
that Ronnie will run to generate the list. g. SELECT * FROM parts SORT BY price DESC
Select one: Question 9
Correct
a. SELECT * FROM parts WHERE price > 10000;
Mark 1.00 out of 1.00

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

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

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


10000; Question text

e. SELECT ALL FROM parts WHERE price > You can relate data to multiple tables using a
‘10000’; foreign key.

f. SELECT ALL FROM parts WHERE price < 10000; Select one:

Question 8 True
Correct

Mark 1.00 out of 1.00 False

Question 10
Incorrect

Mark 0.00 out of 1.00

Flag question

Question text

Display all the records sorted by price from most


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

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


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

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

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


Question 2
e. UPDATE
Correct

Mark 1.00 out of 1.00

BL-PROG-3114-LAB-1922S
PROGG(ORACLE DATABASE) NCIIIP2
Flag question

 Dashboard Question text


 My courses
 BL-PROG-3114-LAB-1922S
Display all the employee's id and salary whose
 Week 3: Use of Single Row Functions
 Learning Activity 1 annual salary is from 100,000 to 200,000. Arrange
the output by salary in descending order.
Started on Thursday, 19 December 2019, 3:35Select
PM one:

State Finished
a. SELECT employee_id, salary FROM employees
Completed on Thursday, 19 December 2019, 3:36WHERE
PM salary *12 >= 100000 AND salary *12 <=
200000 ORDER BY salary desc
Time taken 1 min 35 secs
b. SELECT employee_id, salary FROM employees
Grade 6.00 out of 10.00 (60%)
WHERE salary *12 >= 100000 AND salary *12 <=
Question 1 200000 ORDER BY salary
Correct

Mark 1.00 out of 1.00 c. SELECT employee_id, salary, salary *12 FROM
employees WHERE 12* salary = 100000 AND 12
*salary = 200000 ORDER BY salary

d. SELECT employee_id, salary FROM employees


WHERE salary >= 100000 AND salary <= 200000
Flag question
ORDER BY salary
Question text
Question 3
Correct
Which of the following SELECT statement is the
correct PL/SQL that will display all rows and Mark 1.00 out of 1.00
columns?

Select one:

a. SELECT ALL FROM PARTS;


Flag question

b. SELECT FROM TABLE PARTS; Question text

c. SELECT * FROM PARTS; Display the employee id and the last name of
every employee in the company whose salary is
d. SELECT TABLE PARTS; between 5000 to 10000. Display the output in a
single column with the format 100 : King Label d. SELECT DISTINCT WAREHOUSE AS "No. of
the column as Employee available warehouse" FROM PARTS;
Select one:
Question 5
Correct
a. SELECT CONCAT(CONCAT(employee_id, ':'),
Mark 1.00 out of 1.00
last_name) AS Employee FROM employees
WHERE salary >= 5000 AND salary <= 10000

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


last_name) AS Employee, salary FROM employees
WHERE salary >= 5000 AND salary <= 10000 Flag question

Question text
c. SELECT CONCAT(employee_id, ':', last_name)
AS Employee, salary FROM employees WHERE Display the montly salary of every employee.
salary BETWEEN 5000 TO 10000 Round the salary in 2 decimal places.

d. SELECT CONCAT(employee_id,last_name) AS Select one:


Employee FROM employees WHERE salary >5000
a. SELECT ROUND(salary *12 , 2) /12 FROM
AND 10000
employees;
Question 4
Incorrect b. SELECT (ROUND(salary,2) )/12 FROM
Mark 0.00 out of 1.00 employees;

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


employees;

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


Flag question

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

Question 6
Which of the following SELECT statement is the
Incorrect
correct report that will display the unique value
Mark 0.00 out of 1.00
for WAREHOUSE renames the column as "No. of
Available Warehouse".

Select one:

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


Flag question
available warehouse" FROM PARTS;
Question text
b. SELECT DISTINCT WAREHOUSE AS No. of
available warehouse FROM PARTS; Which of the following SELECT statement is the
correctreport that will combine the column
c. SELECT DISTINCT COLUMN WAREHOUSE AS PARTNUM and DESCRIPTION put a literal
"No. of available warehouse" FROM PARTS; character string "belongs to" in between the two
columns then rename the column as "NUMBER c. SELECT employee_id, job_id, salary FROM
TITLE". Note put space before and after the employees WHERE job_id = 'IT_PROG' AND
character literal string to avoid no spaces in the MOD(salary, 3000)
report.

Select one: d. SELECT employee_id, job_id, salary,


MOD(salary, 3000) FROM employees WHERE
a. SELECT (PARTNUM|| THAT BELONGS TO job_id = 'IT_PROG'
||DESCRIPTION) AS "NUMBER TITLE" FROM
PARTS; e. SELECT employee_id, job_id, salary FROM
employees WHERE job_id = 'IT_PROG' AND
b. SELECT (;PARTNUM'||' THAT BELONGS TO salary/3000
'||'DESCRIPTION;) AS "NUMBER TITLE" FROM
Question 8
PARTS; Incorrect

Mark 0.00 out of 1.00


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

d. SELECT (PARTNUM||' THAT BELONGS TO


'||DESCRIPTION) AS NUMBER TITLE FROM PARTS; Flag question

Question text
Question 7
Incorrect
Which of the following SELECT statement is the
Mark 0.00 out of 1.00
correct PL/SQL that willcreate a report that will
add 10% increase in PRICE? List only the column
DESCRIPTION, CLASS and PRICE.

Select one:
Flag question
a. SELECT PRICE*0.10 FROM PARTS;
Question text
b. SELECT PRICE*10, DESCRIPTION, CLASS FROM
Display all employees id and remainder of the PARTS;
his/her salary after it is divided by 3,000 for all
employees with the job id of IT_PROG. c. SELECT PRICE*0.10, DESCRIPTION, CLASS
Select one: FROM PARTS;

a. SELECT employee_id, job_id, salary, salary/3000 d. SELECT PRICE*10+PRICE, DESCRIPTION, CLASS


FROM employees WHERE job_id = 'IT_PROG' FROM PARTS;

Question 9
b. SELECT employee_id, job_id, salary, Correct
REM(salary/3000) FROM employees WHERE
Mark 1.00 out of 1.00
job_id = 'IT_PROG'
b. SELECT partnum, description, warehouse
FROM parts WHERE partnum = LIKE ‘K%’;

c. SELECT * FROM parts WHERE partnum LIKE


Flag question
'K_';
Question text
d. SELECT partnumber, description, warehouse
Display the employee id, number of years and FROM parts WHERE partnum LIKE 'K*';
the hiring date of every employee in the
company. e. SELECT partnum, description, warehouse
FROM parts WHERE partnum LIKE '*K*';
Select one:

f. SELECT * FROM parts WHERE partnum LIKE


a. SELECT employee_id, hire_date,
'K%';
ROUND((SYSDATE - hire_date),0 /365,0) FROM
employees;
g. SELECT partnumber, description, warehouse
FROM parts WHERE partnum = LIKE ‘K%’;
b. SELECT employee_id, hire_date, hire_date-
SYSDATE /365 FROM employees;

c. SELECT employee_id, hire_date, hire_date /365


BL-PROG-3114-LAB-1922S
FROM employees; PROGG(ORACLE DATABASE) NCIIIP2

d. SELECT employee_id, hire_date,


 Dashboard
ROUND((SYSDATE - hire_date) /365,0) FROM  My courses
employees;  BL-PROG-3114-LAB-1922S
 Week 3: Use of Single Row Functions
Question 10  Learning Activity 1
Correct

Mark 1.00 out of 1.00 Started on Thursday, 19 December 2019, 3:38 PM

State Finished

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

Time taken 1 min 41 secs


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

Select one:

a. SELECT partnum, description, warehouse


FROM parts WHERE partnum LIKE 'K%';
Flag question
Question text
c. index key
Using CREATE SQL Command, you can add new
d. foreign key
records in the table.

Select one: e. relational key

Question 4
True Incorrect

Mark 0.00 out of 1.00


False

Question 2
Correct

Mark 1.00 out of 1.00

Flag question

Question text

Which of the following SELECT statement is the


Flag question
correct PL/SQL that will display eliminate the
Question text duplicate rows for column class and warehouse.

ANSI SQL commands cannot be abbreviated. Select one:

Select one: a. SELECT DISTINCT CLASS, DISTINCT


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

d. SELECT DISTINCT CLASS AND DISTINCT


WAREHOUSE FROM PARTS;

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

Each row of data in a table can be uniquely


identified by a

Select one: Flag question

a. primary key Question text

b. local key
Display the first 5 letter in the surname of all the Incorrect

employees whose firstname starts with letter 'D' Mark 0.00 out of 1.00

Select one:

a. SELECT SUBSTR(surname,1,5), first_name


FROM employees WHERE SUBSTR(first_name,1,1)
IN 'D' Flag question

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

Question 6 c. SELECT (CLASS||PRICE) CLASS PRICE FROM


Correct
PARTS;
Mark 1.00 out of 1.00
d. SELECT (CLASS||PRICE) AS "CLASS PRICE"
FROM PARTS;

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

Which of the following is an Oracle Proprietary


Commands

Select one: Flag question

Question text
a. SQL *Plus
Command use to display table structure
b. SQL
Select one:
c. MySQL Plus
a. DESCRIBE
d. ANSI SQL
b. DISPLAY TABLE
Question 7
c. DISPLAY b. SELECT 'CLASS' FROM PARTS;

d. DISPLAY STRUCTURE c. SELECT CLASS FROM PARTS;

Question 9
d. SELECT CLASS AS CLASS FROM PARTS;
Incorrect

Mark 0.00 out of 1.00 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

Flag question Select one:

Question text a. SELECT CONCAT(last_name, ',', first_name) AS


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

Select one:
a. SELECT (ONHAND||PRICE ||DESCRIPTION
Flag question
FROM PARTS;
Question text
b. SELECT PRICE, ONHAND, DESCRIPTION FROM
PARTS;
Which of the following is the correct report that
will display the CLASS from table PARTS. c. SELECTONHAND,PRICE ,DESCRIPTION FROM
PARTS;
Select one:
d. SELECTONHAND,PRICE DESCRIPTION FROM
PARTS ORDER BY ONHAND;
a. SELECT * CLASS FROM PARTS;
d. SELECT department_id, HIGHEST(salary) FROM
BL-PROG-3114-LAB-1922S employees GROUP BY salary;
PROGG(ORACLE DATABASE) NCIIIP2 Question 2
Incorrect

 Dashboard Mark 0.00 out of 1.00


 My courses
 BL-PROG-3114-LAB-1922S
 Week 5: Reporting Aggregated Data Using
Group Functions
 Long Quiz 1
Flag question
Started on Thursday, 19 December 2019, 7:24 PM
Question text
State Finished
You want to display the employee id, date hired
Completed on Thursday, 19 December 2019, 7:27 PM of all employees whose hired date is September.

Time taken 3 mins 9 secs Which SQL statement give the required output?
Grade 16.00 out of 20.00 (80%)

Question 1
Correct

Mark 1.00 out of 1.00

Select one:

Flag question a. SELECT employee_id, hire_date,


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

Mark 1.00 out of 1.00

Flag question

Question text Flag question

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

Select one: Select one:

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


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

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


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

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


'$999,999.99') AS "MONTHLY SALARY" FROM 'format Month DD, YYYY') AS "Hired Date" FROM
employees WHERE salary < 10,000 employees;
d. SELECT employee_id, TO_CHAR(hire_date,
'fmMonth DD, YYYY') AS "Hired Date" FROM
employees;

Question 5 Flag question


Correct
Question text
Mark 1.00 out of 1.00
John want to know how many part items are
there in warehouse number 3.

What SQL command he need to run?


Select one:
Flag question

Question text a. SELECT COUNT(*) FROM parts WHERE


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

b. SELECT employee_id, hire_date, Mark 1.00 out of 1.00


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,


Flag question
MONTH(hire_date,'Month') AS "Hired Month",
job_id FROM employees WHERE job_id EXCLUDE Question text
('AD_VP');
What is the SQL command to display the date of
d. SELECT employee_id, hire_date, the first employee that was hired?
TO_MONTH(hire_date,'Month') AS "Hired
Select one:
Month", job_id FROM employees WHERE job_id
NOT ('AD_VP'); a. SELECT FIRST(hire_date) FROM employees;
Question 6
Correct b. SELECT hire_date FROM employees WHERE
FIRST(hire_date );
Mark 1.00 out of 1.00
c. SELECT hire_date FROM employees WHERE The General Manager request to the Database
TO_CHAR(hire_date) = ‘FIRST’; Administrator to generate the total salary per
month of every department in the company.
d. SELECT MIN(hire_date) FROM employees; Select one:
Question 8
Correct a. SELECT department_id, salary FROM
employees GROUP BY SUM(salary) ORDER BY
Mark 1.00 out of 1.00
department_id

b. SELECT department_id, TOTAL(salary) FROM


employees GROUP BY department_id

Flag question c. SELECT department_id, SUM(salary) FROM


Question text employees GROUP BY department_id

Aldrin wants to know the outstanding total d. SELECT department_id, salary FROM
balance on hand on every class per warehouse. employees ORDER BY SUM(salary)

Select one: Question 10


Correct

a. SELECT TOTAL(warehouse), TOTAL(class), Mark 1.00 out of 1.00


TOTAL(onhand) FROM parts GROUP BY
warehouse, class

b. SELECT warehouse, class, onhand FROM parts


GROUP BYsum(warehouse), sum(class);
Flag question

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


parts GROUP BY warehouse, class
There was 10% price increase in the all the parts
d. SELECT warehouse, class, onhand FROM parts in warehouse number 3. The Store Manager
GROUP BY warehouse, class asked the Database Administrator to generate a
report showing the part number, the old and new
Question 9
price.
Correct

Mark 1.00 out of 1.00 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


Flag question WHERE warehouse = 3

Question text b. SELECT partnum, price, price * 1.1 FROM parts


WHERE warehouse = 3
c. SELECT partnum, price, price * 1.10% FROM Which of the following SQL command will display
parts WHERE warehouse = 3 all records with part number contains the number
9?
d. SELECT partnum, price, price * 10% FROM Select one:
parts WHERE warehouse = 3
a. SELECT * from parts WHERE partnum LIKE
Question 11
Incorrect '%9%'
Mark 0.00 out of 1.00
b. SELECT partnum FROM parts WHERE partnum
= ‘%9%’

c. SELECT partnum FROM parts WHERE partnum


BETWEEN = ‘%9%’
Flag question

Question text d. SELECT * FROM parts WHERE partnum IN


('%9%')
Display a summary table of the total quantity on
Question 13
hand above 50 very class per warehouse Correct

Select one: Mark 1.00 out of 1.00

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


parts GROUP BY warehouseWHERE
SUM(ONHAND) > 50
Flag question
b. SELECT warehouse, class, sum(onhand) FROM
parts WHERE SUM(ONHAND) > 50 Question text

c. SELECT warehouse, class, sum(onhand) FROM You want to display the last name and the year
parts GROUP BY warehouse,class HAVING when an employee was hired whose job id is
SUM(ONHAND) > 50 IT_PROG.

Which SQL statement give the required output?


d. SELECT warehouse, class, sum(onhand) FROM
Select one:
parts GROUP BY warehouse HAVING
SUM(ONHAND) > 50
a. SELECT last_name, YEAR(hire_date,'YYYY')
Question 12 FROM employees WHERE job_id = ‘IT_PROG’;
Correct

Mark 1.00 out of 1.00


b. SELECT last_name, YEAR(hire_date') FROM
employees WHERE job_id = ‘IT_PROG’;

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


FROM employees WHERE job_id = ‘IT_PROG’;

Flag question
d. SELECT last_name, TO_CHAR(hire_date,'YYYY')
Question text FROM employees WHERE job_id = ‘IT_PROG’;
Question 14
a. SELECT warehouse, class, COUNT(partnum),
Correct
SUM(onhand) FROM parts GROUP BY
Mark 1.00 out of 1.00
warehouse,class HAVING warehouse = 1 OR
warehouse = 2;

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


sum(onhand) GROUP BY warehouse,class
Flag question HAVING warehouse = 1 or warehouse = 2 FROM
Question text parts;

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

b. Error Question 16
Correct

c. 0 rows returned Mark 1.00 out of 1.00

d. 2 rows returned

e. 7 rows returned

Question 15 Flag question


Correct
Question text
Mark 1.00 out of 1.00
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?


Flag question
Select one:
Question text
a. SELECT last_name, hire_date FROM employees
The General Manager request to the Database
WHERE hire_date >= TO_DATE('2000', 'YYYY')
Administrator to generate the total number of
AND hire_date <= TO_DATE('2002', 'YYYY') OR
parts and total outstanding balance on hand of
salary > 5000;
every class in warehouse number 1&2.

Which of the following SQL command will b. SELECT last_name, hire_date FROM employees
generate the required output. WHERE hire_date >= TO_DATE('01-Jan-2000',
'DD-Mon-YYYYY') AND hire_date <=
Select one:
TO_DATE('31-Dec-2002', 'DD-Mon-YYYY')AND Question text
salary ABOVE 5000;
You want to display the employee's last name
c. SELECT last_name, hire_date FROM employees hired from year 2000 to 2002.
WHERE hire_date >= TO_DATE('Jan-2000', Which SQL statement give the required output?
'Month-YYYY') AND hire_date <= TO_DATE('Dec-
Select one:
2002', 'Month-‘YYYY') AND salary > 5,000;

a. SELECT last_name, hire_date FROM employees


d. SELECT last_name, hire_date FROM employees
WHERE hire_date>= TO_DATE('2000', 'YYYY')
WHERE hire_date >= TO_DATE('01-Jan-2002',
AND hire_date<= TO_DATE('2002', 'YYYY')
'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
Question 17 WHERE hire_date>= TO_DATE('01-Jan-2000',
Correct 'DD-Mon-RR') AND hire_date<= TO_DATE('31-
Mark 1.00 out of 1.00 Dec-2002', 'DD-Mon-RR')

c. SELECT last_name, hire_date FROM employees


WHERE hire_date>= TO_DATE('01-Jan-2000',
'DD-Mon-YYYYY') AND hire_date<=
Flag question
TO_DATE('31-Dec-2002', 'DD-Mon-YYYY')

Question text d. SELECT last_name, hire_date FROM employees


WHERE hire_date>= TO_DATE('Jan-2000',
What will be the output of the SQL command?
'Month-YYYY') AND hire_date<= TO_DATE('Dec-
SELECT SUM(onhand) FROM PARTS where class
2002', 'Month-‘YYYY')
= 'HW' OR class = 'AP' AND warehouse = 1;
Question 19
Select one: Incorrect

Mark 0.00 out of 1.00


a. 85

b. 178

c. 44
Flag question
d. 137
Question text
Question 18
Incorrect Display the warehouse number, class, highest
Mark 0.00 out of 1.00 price & lowest price, total on hand balance
whose class is AP.

Sort the output by warehouse number.


Select one:

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

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


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

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

State Finished
Flag question Completed on Thursday, 19 December 2019, 7:35 PM
Question text
Time taken 3 mins 55 secs

You want to display the employee’s last name whose Grade 19.00 out of 20.00 (95%)
salary is below 10,000 and whose lastname starts with
letter K. Question 1
Correct
Which SQL statement give the required output
Mark 1.00 out of 1.00
format of the salary?
Flag question Flag question

Question text Question text

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

a. SELECT salary FROM


COUNT(employees)WHERE salary < 10000;

b. SELECT COUNT(salary) FROM employees


WHERE salary < 10,000;

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


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

c. SELECT employee_id, hire_date,


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

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

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


Question 4
Correct b. SELECT FIRST(hire_date) FROM employees;
Mark 1.00 out of 1.00
c. SELECT hire_date FROM employees WHERE
FIRST(hire_date );

d. SELECT hire_date FROM employees WHERE


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

Mark 1.00 out of 1.00


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

Which of the following SQL command will


produce the output.
Select one: Flag question

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

d. SELECT ALL FROM COUNT(parts) WHERE


warehouse = 3;

Flag question Question 7


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

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


Question text MIN(PRICE), sum(onhand)
FROM parts
Aldrin wants to know the highest salary in every WHERE class = 'AP'
department. Which of the following SQL GROUP BY warehouse, class, price
command will display the required output? ORDER BY warehouse, class
Select one:
c. SELECT warehouse, class, HIGH(price),
LOW(PRICE), SUM(onhand)
a. SELECT department_id, HIGHEST(salary) FROM
FROM parts
employees GROUP BY salary;
GROUP BY warehouse
b. SELECT department_id, MAXIMUM(salary) WHERE class = 'AP'
FROM employees GROUP BY department_id; ORDER BY warehouse, class;

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


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

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

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

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


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

b. SELECT employee_id, d. SELECT employee_id, hire_date,


TO_MONTH(hire_date,'Month') AS 'Hired TO_CHAR(hire_date,'Month') AS "Hired Month",
Month'FROM employees; job_id FROM employees WHERE job_id NOT IN
('AD_VP');
c. SELECT employee_id, hire_date,
TO_CHAR(hire_date,'Month') AS "Hired Month" Question 11
Correct
FROM employees;
Mark 1.00 out of 1.00
d. SELECT employee_id, hire_date,
MONTH(hire_date) AS "Hired Month" FROM
employees;

Question 10
Correct Flag question

Mark 1.00 out of 1.00 Question text

You want to display the employee's last name


hired from year 2000 to 2002.

Which SQL statement give the required output?


Flag question
Select one:
Question text
a. SELECT last_name, hire_date FROM employees
You want to display all the employee id and the WHERE hire_date>= TO_DATE('01-Jan-2000',
month an employee was hired excluding 'DD-Mon-YYYYY') AND hire_date<=
employees whose job id is AD_VP. Which SQL TO_DATE('31-Dec-2002', 'DD-Mon-YYYY')
statement give the required output?
b. SELECT last_name, hire_date FROM employees
Select one:
WHERE hire_date>= TO_DATE('01-Jan-2000',
'DD-Mon-RR') AND hire_date<= TO_DATE('31-
a. SELECT employee_id, hire_date,
Dec-2002', 'DD-Mon-RR')
TO_DATE(hire_date,'Month') AS "Hired Month",
job_id FROM employees WHERE job_id NOT =
c. SELECT last_name, hire_date FROM employees
'AD_VP';
WHERE hire_date>= TO_DATE('Jan-2000',
'Month-YYYY') AND hire_date<= TO_DATE('Dec-
b. SELECT employee_id, hire_date,
2002', 'Month-‘YYYY')
TO_MONTH(hire_date,'Month') AS "Hired
Month", job_id FROM employees WHERE job_id
d. SELECT last_name, hire_date FROM employees
NOT ('AD_VP');
WHERE hire_date>= TO_DATE('2000', 'YYYY')
AND hire_date<= TO_DATE('2002', 'YYYY')
Question 12 TO_DATE('31-Dec-2002', 'DD-Mon-YYYY')AND
Correct salary ABOVE 5000;
Mark 1.00 out of 1.00
b. 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;
Flag question
c. SELECT last_name, hire_date FROM employees
Question text WHERE hire_date >= TO_DATE('2000', 'YYYY')
AND hire_date <= TO_DATE('2002', 'YYYY') OR
What will be the output of the SQL command?
salary > 5000;
SELECT SUM(onhand) FROM PARTS where class
= 'HW' OR class = 'AP' AND warehouse = 1; d. SELECT last_name, hire_date FROM employees
Select one: WHERE hire_date >= TO_DATE('01-Jan-2002',
'DD-Mon-RR') AND hire_date <= TO_DATE('31-
a. 137 Dec-2002', 'DD-Mon-RR') AND salary > 5000;

Question 14
b. 178
Correct

c. 85 Mark 1.00 out of 1.00

d. 44

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

You want to display the employee's last name


whose salary is below 10,000.
Flag question Which SQL statement give the required output
Question text format of the salary?
Required output :
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 <=
a. SELECT warehouse, class, sum(onhand) FROM
parts WHERE SUM(ONHAND) > 50

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


parts GROUP BY warehouse HAVING
SUM(ONHAND) > 50

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


parts GROUP BY warehouse,class HAVING
SUM(ONHAND) > 50

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


Select one: parts GROUP BY warehouseWHERE
SUM(ONHAND) > 50
a. SELECT last_name, TO_INT(salary,
Question 16
'$999,999.99') AS "MONTHLY SALARY" FROM Correct
employees WHERE salary < 10,000
Mark 1.00 out of 1.00

b. SELECT last_name, TO_INTEGER(salary,


$999,999.99) AS "MONTHLY SALARY" FROM
employees WHERE salary < 10000

c. SELECT last_name, TO_CHAR(salary, Flag question


'$999,999.99') AS "MONTHLY SALARY" FROM Question text
employees WHERE salary < 10000
The General Manager request to the Database
d. SELECT last_name, TO_NUMBER(salary, Administrator to generate the total salary per
'$999,999.99') AS "MONTHLY SALARY" FROM month of every department in the company.
employees WHERE salary < 10,000
Select one:
Question 15
Incorrect a. SELECT department_id, SUM(salary) FROM
Mark 0.00 out of 1.00 employees GROUP BY department_id

b. SELECT department_id, TOTAL(salary) FROM


employees GROUP BY department_id

c. SELECT department_id, salary FROM


Flag question
employees GROUP BY SUM(salary) ORDER BY
Question text department_id

Display a summary table of the total quantity on d. SELECT department_id, salary FROM
hand above 50 very class per warehouse employees ORDER BY SUM(salary)
Select one: Question 17
Correct
Mark 1.00 out of 1.00
b. SELECT employee_id, YEAR(hire_date,'YYYY')
FROM employees;

c. SELECT employee_id,
TO_CHAR(hire_date,'YYYY') FROM employees;
Flag question

Question text d. SELECT employee_id,


TO_YEAR(hire_date,'YYYY') FROM employees;
Which of the following SQL command will display
Question 19
the summary table showing the total quantity on Correct
hand per class.
Mark 1.00 out of 1.00
Select one:

a. SELECT class, TOTAL(onhand) AS "QTY ON


HAND" FROM parts GROUP BY class, onhand
Flag question
b. SELECT class, sum(onhand) AS "QTY ON
HAND" FROM parts GROUP BY onhand Question text

c. SELECT class, onhand AS "QTY ON HAND" Aldrin wants to know the outstanding total
FROM parts GROUP BY sum(onhand) balance on hand on every class per warehouse.

Select one:
d. SELECT class, sum(onhand) AS "QTY ON
HAND" FROM parts GROUP BY class a. SELECT warehouse, class, onhand FROM parts
Question 18
GROUP BY warehouse, class
Correct
b. SELECT TOTAL(warehouse), TOTAL(class),
Mark 1.00 out of 1.00
TOTAL(onhand) FROM parts GROUP BY
warehouse, class

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


parts GROUP BY warehouse, class
Flag question

Question text d. SELECT warehouse, class, onhand FROM parts


GROUP BYsum(warehouse), sum(class);
You want to display the employee id and the year
Question 20
when an employee was hired. Correct

Which SQL statement give the required output? Mark 1.00 out of 1.00

Select one:

a. SELECT employee_id, YEAR(hire_date') FROM


employees;
Flag question
Question text Time taken 1 min 44 secs

You want to display the employee’s last name whose Grade 6.00 out of 10.00 (60%)
salary is below 10,000 and whose lastname starts with
Question 1
letter K. Incorrect

Which SQL statement give the required output Mark 0.00 out of 1.00
format of the salary?
Select one:

a. SELECT last_name, TO_NUMBER(salary,


'$999,999.99') AS "MONTHLY SALARY" FROM Flag question
employees WHERE salary < 10,000WHERE
Question text
last_name = ‘K%’
Create a SQL command to update the employees
b. SELECT last_name, TO_CHAR(salary,
table
'$999,999.99') AS "MONTHLY SALARY" FROM
employees WHERE salary < 10000WHERE Employee id : 200
last_name LIKE ‘K%’ Name : Mr. Gary Park

c. SELECT last_name, TO_INTEGER(salary, Date hired : July 1, 2017


$999,999.99) AS "MONTHLY SALARY" FROM Position :IT Programmer
employees WHERE salary < 10000 WHERE Salary : 10000
last_name IN 'K%'
Department of assignment : 60
d. SELECT last_name, TO_INT(salary, Reporting to manager : 103
'$999,999.99') AS "MONTHLY SALARY" FROM Select one:
employees WHERE salary < 10,000 WHERE
last_name STARTS 'K%' a. INSERT INTO employees
(employee_id,first_name,last_name,hire_date,job_i
d,salary,manager_id,department_id)
BL-PROG-3114-LAB-1922S VALUES (200,'Gary','Park',TO_DATE('Jul 1, 2017',
PROGG(ORACLE DATABASE) NCIIIP2 'MON DD, YYYY'), 'IT_PROG', 10000, 103, 60)

b. INSERT FROM employees


 Dashboard
 My courses VALUES (200,'Gary','Park',TO_DATE('Jul 1, 2017',
 BL-PROG-3114-LAB-1922S 'MON DD, YYYY'), 'IT_PROG', 10000, 103, 60)
 Week 7: Manipulate Data
 Learning Activity 2 c. INSERT FROM employees
VALUES (200,'Gary','Park', TO_CHAR('Jul 1, 2017',
Started on Thursday, 19 December 2019, 7:49 PM 'MON DD, YYYY'), 'IT_PROG', 10000, 103, 60)

State Finished
d. INSERT INTO employees
Completed on Thursday, 19 December 2019, 7:51 PM (employee_id,first_name,last_name,hire_date,job_i
d,salary,manager_id,department_id)
VALUES (200,'Gary','Park', TO_CHAR('Jul 1, 2017', a. UPDATE salary FROM employees SET salary +
'MON DD, YYYY'), 'IT_PROG', 10000, 103, 60) 500 where TO_YEAR(sysdate,'YYYY') -
Question 2 TO_YEAR(hire_date,'YYYY') >= 10
Correct
b. UPDATE salary= salary + 500 where
Mark 1.00 out of 1.00
TO_DATE(sysdate,'YYYY') -
TO_DATE(hire_date,'YYYY') >= 10

c. UPDATE employees SET salary = salary + 500


where TO_CHAR(sysdate,'YYYY') -
Flag question
TO_CHAR(hire_date,'YYYY') >= 10
Question text
d. UPDATE employees SET salary = salary + 500
Remove the Shareholder Services department in where YEAR(sysdate,'YYYY') -
the department table YEAR(hire_date,'YYYY') >= 10
Select one: Question 4
Correct
a. DELETE * FROM departments_name HAVING Mark 1.00 out of 1.00
department_name LIKE '%Shareholder Services%'

b. DELETE departments FROM


departments_name WHERE department_name =
‘%Shareholder Services%’
Flag question

c. None of the choices Question text

d. DELETE FROM departments WHERE Given the SQL command


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

Flag question Select one:

Question text
a. List of employees name, salary and
Add a 500 pesos increase in salary of all department name
employees who have rendered services 10 years
b. Cartesian Product
and above.

Select one: c. Results to invalid SQL command


d. Results to invalid relational operator

e. Display a full outer join

Question 5 Flag question


Incorrect
Question text
Mark 0.00 out of 1.00
Display all the employee id, names of employees
,job id and department nameof all employees of
the Finance Department.

Select one:
Flag question

Question text a. SELECT first_name, last_name, job_id,


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

Mark 1.00 out of 1.00


d. UPDATE departments_name FROM
departments SET department_name =
'Procurement', SET manager_id = 200 WHERE
department_name = 'Purchasing'

Question 6 Flag question


Incorrect
Question text
Mark 0.00 out of 1.00
A new department name Training with
department id 300 was created in the company.
This will be managed by a Manager with ID of d. INSERT FROM jobs(jobs_id, job_title,
203 and will located at location id 2400. min_salary, max_salary) VALUES ('JAVA_DEV',
Create a SQL command to update the 'Java Developer', 7000, 8000)
information in the department table.
Question 9
Select one: Correct

Mark 1.00 out of 1.00


a. INSERT INTO departments SET department_id
= 300, department_name = 'Training',
manager_id = 203, location_id = 2400

b. INSERT FROM departments(department_id,


Flag question
department_name, manager_id, location_id)
VALUES (300, 'Training', 203, 2400) Question text

c. INSERT INTO departments VALUES (300, Create a SQL command to add a new position
'Training', 203, 2400) Database Administrator with job id of DB_ADMIN
whose salary ranges from 10,000 to 18,000.
d. INSERT * FROM departments VALUES (300,
Select one:
'Training', 203, 2400)

Question 8 a. INSERT * FROM jobs VALUES ('DB_ADMIN',


Correct 'Database Administrator', 10000, 18000)
Mark 1.00 out of 1.00
b. INSERT FROM jobs VALUES ('DB_ADMIN',
'Database Administrator', 10000, 18000)

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


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

Select one: Mark 0.00 out of 1.00

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


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

c. INSERT INTO jobs VALUES ('JAVA_DEV', 'Java


Developer', 7000, 8000)
Update the Treasury department to Cash
department. And this will be managed by the
Manager of Finance department.

Select one: Flag question

Question text
a. UPDATE FROM departments SET
department_name = 'Procurement', SET
Create a SQL command to add a new position
manager_id = 100 HAVING department_name =
Java Developer with job id of JAVA_DEV whose
'Treasury'
salary ranges from 7,000 to 8,000.

b. UPDATE department_name = 'Procurement', Select one:


manager_id = 100 FROM departmentsWHERE
department_name = 'Treasury' a. INSERT FROM jobs SET jobs_id = ‘JAVA_DEV’,
job_title = ‘Java Developer’ , min_salary =7000 ,
c. UPDATE department_name = 'Procurement' max_salary= 8000
AND manager_id = 100FROM departments
WHERE department_name = 'Treasury' b. INSERT * INTO jobs VALUES (JAVA_DEV, Java
Developer, 7000, 8000)
d. UPDATE departments SET department_name =
'Procurement', manager_id = 100 WHERE c. INSERT INTO jobs VALUES ('JAVA_DEV', 'Java
department_name = 'Treasury' Developer', 7000, 8000)

d. INSERT FROM jobs(jobs_id, job_title,


BL-PROG-3114-LAB-1922S min_salary, max_salary) VALUES ('JAVA_DEV',
PROGG(ORACLE DATABASE) NCIIIP2 'Java Developer', 7000, 8000)

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

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


Flag question
State Finished
Question text
Completed on Thursday, 19 December 2019, 7:55 PM
A new department name Training with
Time taken 1 min 16 secs
department id 300 was created in the company.
Grade 9.00 out of 10.00 (90%) This will be managed by a Manager with ID of
203 and will located at location id 2400.
Question 1
Correct Create a SQL command to update the
Mark 1.00 out of 1.00 information in the department table.
Select one:
Question 4
a. INSERT * FROM departments VALUES (300,
Correct
'Training', 203, 2400)
Mark 1.00 out of 1.00

b. INSERT INTO departments SET department_id


= 300, department_name = 'Training',
manager_id = 203, location_id = 2400

c. INSERT FROM departments(department_id, Flag question


department_name, manager_id, location_id)
Question text
VALUES (300, 'Training', 203, 2400)
Given the SQL command
d. INSERT INTO departments VALUES (300,
SELECT employees.first_name,
'Training', 203, 2400)
employees.last_name,
Question 3 employees.salary,departments.department_name
Correct FROM employees, departments
Mark 1.00 out of 1.00 WHERE employees.department_id =
departments.department_id;
Which of the following describes the SQL
command?

Select one:
Flag question

Question text a. Results to invalid relational operator

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


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

Question 5
b. SELECT E.employee_id, D.manager_id FROM
Correct
employees E INNER JOIN departments D USING
Mark 1.00 out of 1.00
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
Flag question
d. SELECT E.employee_id, D.manager_id FROM
Question text
employees E JOIN departments D ON
E.department_id = D.department_id Remove all Manager positions in the department
table.
Select one: Incorrect

Mark 0.00 out of 1.00


a. DELETE * FROM jobs WHERE job_title =
‘%Manager%’;

b. DELETE job_title FROM jobs WHERE


IN(job_title) = ‘%Manager%’;
Flag question

c. DELETE jobs FROM jobs_id = ‘*MGR*’ Question text

d. DELETE FROM jobs WHERE job_title LIKE Diana Lorentz was transferred to Administration
'%Manager%'; department. Using the employees and
department table information update the profile
Question 6
Correct
of employee.

Mark 1.00 out of 1.00 Select one:

a. UPDATE FROM employees SET manager_id =


200, department_id = 10 WHERE last_name =
'Lorentz' AND first_name = 'Diana';
Flag question
b. UPDATE employees SET manager_id = 200,
Question text department_id = 10 WHERE last_name = 'Lorentz'
AND first_name = 'Diana';
Add a 500 pesos increase in salary of all
employees who have rendered services 10 years c. UPDATE FROM employees SET manager_id =
and above. 200, SET department_id = 10 WHERE last_name =
Select one: 'Lorentz' AND first_name = 'Diana';

a. UPDATE employees SET salary = salary + 500 d. UPDATE employees SET manager_id = 200,
where TO_CHAR(sysdate,'YYYY') - SET department_id = 10 WHERE last_name =
TO_CHAR(hire_date,'YYYY') >= 10 'Lorentz' AND first_name = 'Diana';

Question 8
b. UPDATE salary FROM employees SET salary + Correct
500 where TO_YEAR(sysdate,'YYYY') -
Mark 1.00 out of 1.00
TO_YEAR(hire_date,'YYYY') >= 10

c. UPDATE salary= salary + 500 where


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

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


where YEAR(sysdate,'YYYY') -
YEAR(hire_date,'YYYY') >= 10 Remove the Shareholder Services department in
the department table
Question 7
Select one: d. SELECT first_name, last_name, salary FROM
employees JOIN departments USING
a. DELETE * FROM departments_name HAVING
(department_id) WHERE salary >= 5000 AND
department_name LIKE '%Shareholder Services%'
salary <= 10000
b. DELETE FROM departments WHERE Question 10
department_name = ‘Shareholder Services’ Correct

Mark 1.00 out of 1.00


c. DELETE departments FROM
departments_name WHERE department_name =
‘%Shareholder Services%’

d. None of the choices


Flag question
Question 9
Correct
Question text

Mark 1.00 out of 1.00 Given the SQL command


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

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


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

b. SELECT first_name, last_name, salary FROM


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

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

Potrebbero piacerti anche