Database by Kuya NR
Database by Kuya NR
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
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.
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’
Flag question
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
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
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
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.
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
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
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;
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
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
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';
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
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
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 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
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
Flag question
Flag question
Question text
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 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
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 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 text
What is the SQL command to count the number of
records in the employees table?
Select one:
a. SELECT ALL FROM employees
b. SELECT * FROM employees;
c. SELECT COUNT(*) FROM employees
d. SELECT SUM(*) FROM employees;