PROG 114 Lolix3
PROG 114 Lolix3
PROG 114 Lolix3
***readme thing is at the last page of the file, at niremove ko yung password for convenience
purposes. -keenplify
A join between two tables that returns the results of an INNER join as well as the results of a left
and right join is a _____________.
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?
Display all the employee id, names of employees ,job id and department nameof all employees
of the Finance Department.
Create a SQL command to add a new position Database Administrator with job id of DB_ADMIN
whose salary ranges from 10,000 to 18,000.
Diana Lorentz was transferred to Administration department. Using the employees and
department table information update the profile of employee.
UPDATE employees SET manager_id = 200, department_id = 10 WHERE last_name = 'Lorentz'
AND first_name = 'Diana';
Display part number description and warehouse number whose part number starts with letter K.
f. SELECT partnum, description, warehouse FROM parts WHERE partnum LIKE 'K%';
A join between two tables that returns the results of the INNER join as well as the_______________
rows from the left (or right) table is called a left (or right) OUTER join.
Unmatched
Angelica is the Oracle Database Administrator. She was been assigned to create an access for the
newly hired employee named Matt to the Oracle Database.
Display all the records sorted by price from most expensive to the cheapest parts.
Display all the records whose stock is below 20 and in warehouse number 3.
Display part number description and warehouse number whose part number starts with letter K.
Answer: SELECT partnum, description, warehouse FROM parts WHERE partnum LIKE 'K%';
Answer: None of the choicesRoonie is the stockman in the warehouse of ATR Corporation. The
General Manager wants to know the parts whose price is above 10000 and above.
Which of the following SQL command will display all records with class code of AP?
Which of the following SQL commands will display all stocks whole class is HW or AP.
Which of the following SQL commands will display all the stocks on hand from 10 to 30?
Select one:
Add a 500 pesos increase in salary of all employees who have rendered services 10 years andabove.
Which of the following DOES NOT describes the state of the data after the COMMIT command
Locks the rows in the EMPLOYEES table with department id is 60.Which of the following will erase all
records in the departments table
Which of the following SELECT statement is the correct PL/SQL that willcreate a report that will add
10% increase in PRICE? List only the column DESCRIPTION, CLASS and PRICE.
Which of the following SQL command will display all records with class code of AP?
Which of the following SQL commands will display all the stocks on hand from 10 to 30?
Display all the records whose stock is below 20 and in warehouse number 3.
SELECT * FROM parts WHERE onhand< 20 AND warehouse = 3;
Display the montly salary of every employee. Round the salary in 2 decimal places.
Which of the following SQL commands will display all stocks whose class is HW or AP.
True
True
DROP
CREATE
You can relate data to multiple tables using a foreign key.
Select one:
True
SQL *Plus
Display the last day of the month and the hiring date when the employees are hired in the company.
Which of the following is the correct report that will display the CLASS from table PARTS.
You want to cancel the privilege of matt to retrieve records from the employees table.
Which of the following command will delete all records in the table employees
DELETE FROM employees
Schema
Display employee's name and id whose firstname starts with letter D and job id is IT_PROG.Sort the
output by department.
SELECT employee_id, first_name, last_name FROM employees WHERE first_nameLIKE 'D%' and job_id
= 'IT_PROG' ORDER BY department_id
Which of the following SELECT statement is the correctreport the will merge the column CLASS and
PRICE rename the COLUMN as "CLASS PRICE".
Which of the following SELECT statement is the correct PL/SQL that will display all rows and columns?
Ronnie is the stockman in the warehouse of ATR Corporation. The General Manager wants to know
the parts whose price is above 10000 and above. Which of the following SQL command that Ronnie
will run to generate the list.
OR
c. DESCRIBE
Display the first 3 letter in the first name of all the employees.
Every employee will get a bonus of 150% of his/her current salary. Display the employee id, salary
and the bonus of every employee. Label the computed bonus with Bonus
List all the employee_id of all employees whose salary is 5000 and below and belong to department
60 or 100.
d. SELECT partnum FROM parts WHERE class NOT IN ('HW', 'AG', SG')
Display the name, jobs id and salary of the all the employees whose department id is 100 and salary
is below 8000. Arrange the output by salary in ascending order.
SELECT first_name, last_name, salary FROM employees WHERE department_id = 100 AND salary <
8000 ORDER BY salary
Display employee's name and id whose firstname starts with letter D and job id is SA_REP. Sort the
output by department.
SELECT employee_id, first_name, last_name FROM employees WHERE first_name LIKE 'D%' and
job_id = 'IT_PROG' ORDER BY department_id
List all the employee_id of all employees whose salary is 5000 and below and belong to department
60 or 100.
SELECT employee_id,salary, department_id FROM employees WHERE salary < 5000 AND
department_id IN (60,100)
Using CREATE SQL Command, you can add new records in the table.
False
Display all the records sorted by price from most expensive to the cheapest parts.
Display all the records whose stock is below 20 and in warehouse number 3.
Display all the employee's id and salary whose annual salary is from 100,000 to 200,000. Arrange the
output by salary in descending order.Select one:
a. SELECT employee_id, salary FROM employees WHERE salary *12 >= 100000 AND salary *12 <=
200000 ORDER BY salary desc
Display the first 5 letter in the surname of all the employees whose firstname starts with letter 'D'
Which of the following SELECT statement is the correct PL/SQL that willcreate a report specifying
only the column PRICE, ONHAND and DESCRIPTION?
Using CREATE SQL Command, you can add new records in the table.
False
Display all the employee's id and salary whose annual salary is from 100,000 to 200,000. Arrange the
output by salary in descending order.
d. SELECT employee_id, salary FROM employees WHERE salary *12 >= 100000 AND
salary *12 <= 200000 ORDER BY salary desc
Using Data Manipulation Language, you can ADD columns in the table.
False
False
What is the SQL command to display the date of the first employee that was hired?
Select one:
True
Which of the following SELECT statement is the correct report that will deduct 5 from ONHAND, multiply
5 in WAREHOUSE, after getting the value on both ONHAND and WAREHOUSE add their data: as
shown below: ONHAND - 5 + 5 * WAREHOUSE
Note that you have to force the Oracle to prioritize first the Subtraction over Multiplication. List only the
column DESCRIPTION, ONHAND and WAREHOUSE.
Which of the following Select statement is the correct report that will display the unique value for
WAREHOUSE renames the column as "No. of Available Warehouse"
Which of the following SELECT statement is the correctreport the will merge the column CLASS and
PRICE rename the COLUMN as "CLASS PRICE"
Which of the following SELECT statement is the correct PL/SQL that will display eliminate the
duplicate rows for column class and warehouse.
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?
Create a SQL command to add a new position database administrator with job id of DB_ADMIN
whose salary ranges from 10,000 to 18,000
Update the Purchasing department name to Procurement. And this will be managed by the
Manager of Administration department.
John want to know how many employees receiving salary below 10,000
What is the SQL command to display the date of the first employee that was hired?
Aldrin wants to know the highest salary in every department. which of the following sql will display
the required output?
Answer: SELECT department_id,MAX(SALARY) FROM employees GROUP BY department_id
The general manager request to the database administrator to generate the total salary per month
of every department in the company.
Ella what to generate the average salary of all employees whose job function is IT_PROG.
Display the warehouse number, class, highest price & lowest price, total on hand balance whose
class is AP.
Question 1
Complete
Mark 2.00 out of 2.00
Flag question
Question text
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 >= 5000 AND max_salary<= 10000
b. SELECT job_title FROM employees WHERE salary >= 5000 AND salary <= 10000
c. SELECT employees_id, job_title FROM employees WHERE salary >= 5000 AND salary <= 10000
d. SELECT job_title FROM jobs WHERE salary >= 5000 AND salary <= 10000
Question 2
Complete
Mark 2.00 out of 2.00
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;
Question 3
Complete
Mark 2.00 out of 2.00
Flag question
Question text
True or False. The AND, OR, NOT are comparison operators.
Select one:
True
False
Question 4
Complete
Mark 2.00 out of 2.00
Flag question
Question text
Evaluate the following SQL command
SELECT * FROM jobs WHERE job_title LIKE 'Manager%'
Select one:
a. The SQL command will produce an error.
b. The SQL command will display all employees with Manager position
c. The SQL command will display all records in the database
d. No records will be displayed
Question 5
Complete
Mark 2.00 out of 2.00
Flag question
Question text
You want to display all the employee id and the month an employee was hired.
Which SQL statement give the required output?
Select one:
a. SELECT employee_id, hire_date, TO_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 FROM
employees
c. SELECT employee_id, hire_date, TO_CHAR(hire_date,'Month') AS "Hired Month", job_id FROM
employees
d. SELECT employee_id, hire_date, TO_MONTH(hire_date,'Month') AS "Hired Month", job_id FROM
employees
Question 6
Complete
Mark 2.00 out of 2.00
Flag question
Question text
You want to generate the total salary per month of every department in the company.
Select one:
a. SELECT department_id, salary FROM employees ORDER BY SUM(salary)
b. SELECT department_id, TOTAL(salary) FROM employees GROUP BY department_id
c. SELECT department_id, salary FROM employees GROUP BY SUM(salary) ORDER BY
department_id
d. SELECT department_id, SUM(salary) FROM employees GROUP BY department_id
Question 7
Complete
Mark 2.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.
Which SQL statement give the required output format of the salary?
Select one:
a. SELECT last_name, TO_INT(salary, '$999,999.99') AS "MONTHLY SALARY" FROM employees
WHERE salary < 10,000 WHERE last_name STARTS 'D%'
b. SELECT last_name, TO_CHAR(salary, '$999,999.99') AS "MONTHLY SALARY" FROM employees
WHERE salary < 10000 WHERE last_name LIKE 'D%'
c. SELECT last_name, TO_INTEGER(salary, $999,999.99) AS "MONTHLY SALARY" FROM
employees WHERE salary < 10000 WHERE last_name IN 'D%'
d. SELECT last_name, TO_NUMBER(salary, '$999,999.99') AS "MONTHLY SALARY" FROM
employees WHERE salary < 10,000 WHERE last_name = ‘D%’
Question 8
Complete
Mark 2.00 out of 2.00
Flag question
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
Select one:
a. None of the choices
b. SELECT CONCATENATE(first_name, last_name) AS Fullname FROM employees
c. SELECT CONCAT(first_name, last_name) FROM employees
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
Display the first 5 letter in the surname of all the employees whose firstname starts with letter 'N'
Select one:
a. SELECT SUBSTR(last_name,1,5), first_name FROM employees WHERE first_name IN 'N'
b. SELECT SUBSTR(last_name,1,5), first_name FROM employees WHERE SUBSTR(first_name,1,1) =
'N'
c. SELECT SUBSTR(surname,1,5), first_name FROM employees WHERE SUBSTR(first_name,1,1) IN
'N'
d. SELECT SUBSTR(surname,1,5), first_name FROM employees WHERE first_name = 'N'
e. SELECT SUBSTR(last_name,1,5), first_name FROM employees WHERE SUBSTR(first_name,1,1)
IN 'N'
Question 10
Complete
Mark 2.00 out of 2.00
Flag question
Question text
Austin David was transferred to Purchasing Department. You are assigned to update the database.
Which of the following SQL command will satisfy the requirements?
Select one:
a. UPDATE first_name = ‘David’ AND last_name = ‘Austin’ FROM employees SET department_id = 30
b. UPDATE department_id = 30 WHERE first_name = ‘David’ AND last_name = ‘Austin’
c. UPDATE employees WHERE department_id = 30 SET first_name = ‘David’ AND last_name = ‘Austin’
d. UPDATE employees SET department_id = 30 WHERE first_name = ‘David’ AND last_name = ‘Austin’
Question 11
Complete
Mark 2.00 out of 2.00
Flag question
Question text
John want to know how many employees receiving salary below 10,000.
What SQL command he need to run?
Select one:
a. SELECT COUNT(*) FROM employees WHERE salary < 10000;
b. SELECT COUNT(salary) FROM employees WHERE salary < 10,000;
c. SELECT COUNT(emp_id) FROM employees WHERE salary <= 10000;
d. SELECT salary FROM COUNT(employees)WHERE salary < 10000;
Question 12
Complete
Mark 2.00 out of 2.00
Flag question
Question text
Evaluate the following SQL command
SELECT employee_id, salary, department_id FROM employees WHERE department_id IN (60,70)
Select one:
a. The SQL command will produce an error.
b. The SQL command will display employees with department id 60 and 70.
c. The SQL command will give an incorrect output.
d. The SQL command will display employees with department id 60 or 70.
Question 13
Complete
Mark 2.00 out of 2.00
Flag question
Question text
You want to display the employee's last name and date hired in year 2000 to2006 whose salary is above
5000. Which SQL statement give the required output?
Select one:
a. SELECT last_name, hire_date FROM employees WHERE hire_date>=
TO_DATE('01-Jan-2006', 'DD-Mon-RR') AND hire_date<= TO_DATE('31-Dec-2006', 'DD-Mon-RR') AND
salary > 5000;
b. SELECT last_name, hire_date FROM employees WHERE hire_date>=
TO_DATE('Jan-2000', 'Month-YYYY') AND hire_date<= TO_DATE('Dec-2006', 'Month-‘YYYY') AND
salary > 5,000;
c. SELECT last_name, hire_date FROM employees WHERE hire_date>=
TO_DATE('01-Jan-2000', 'DD-Mon-YYYYY') AND hire_date<= TO_DATE('31-Dec-2006', 'DD-Mon-
YYYY') AND salary ABOVE 5000;
d. SELECT last_name, hire_date FROM employees WHERE hire_date>=
TO_DATE('2000', 'YYYY') AND hire_date<= TO_DATE('2006', 'YYYY') OR salary > 5000;
Question 14
Complete
Mark 2.00 out of 2.00
Flag question
Question text
List all employees except for IT_PROG job id.
Select one:
a. SELECT *FROM employees EXCEPT JOB_ID != 'IT_PROG'
b. SELECT *FROM employees WHERE JOB_ID NOT IN ('IT_PROG')
c. SELECT *FROM employees WHERE JOB_ID <> 'IT_PROG'
d. All of the choices
Question 15
Complete
Mark 2.00 out of 2.00
Flag question
Question text
Evaluate the following SQL command
SELECT employee_id, min_salary, max_salary FROM employees, departments WHERE
salary>= 10000 && salary <= 20000
Select one:
a. The SQL will produce Cartesian Product
b. The SQL will display the employee id, department id and the minimum and maximum salary whose
salary is between 10000 and 20000.
c. The SQL command will produce an error.
d. The SQL command will give an incorrect output.
Question 16
Complete
Mark 2.00 out of 2.00
Flag question
Question text
Display all the records in the employee table. Arrange the output in by lastname from A-Z order.
Select one:
a. SELECT * FROM employees SORT BY lastname
b. SELECT * FROM employees ORDER BY lastname
c. SELECT * FROM employees ORDER BY lastname AZ
d. SELECT * FROM employees SORT BY lastname ascending
Question 17
Complete
Mark 2.00 out of 2.00
Flag question
Question text
Display employee's name and id whose firstname starts with letter D and job id is IT_PROG.
Sort the output by department.
Select one:
a. SELECT employee_id, first_name, last_name FROM employees ORDER BY department_id WHERE
first_name LIKE 'D%' and job_id = 'IT_PROG'
b. SELECT employees FROM employee_id, first_name, last_name WHERE first_name LIKE ‘D%’ and
job_id = ‘IT_PROG’ ORDER BY department_id
c. SELECT employee_id, first_name, last_name FROM employees WHERE job_id = 'IT_PROG' OR
first_name LIKE 'D%' and ORDER BY department_id
d. SELECT employee_id, first_name, last_name FROM employees WHERE first_name LIKE 'D%' and
job_id = 'IT_PROG' ORDER BY department_id
Question 18
Complete
Mark 2.00 out of 2.00
Flag question
Question text
You what to generate the average salary of all employees whose job function is FI_ACCOUNT.
Which of the following SQL command will produce the output.
Select one:
a. SELECT AVERAGE(salary) FROM employees WHERE job_id = 'FI_ACCOUNT';
b. SELECT AVG(salary) FROM employees WHERE job_id = 'FI_ACCOUNT';
c. SELECT AVE(salary) FROM employees WHERE job_id = 'FI_ACCOUNT';
d. SELECT COUNT AVG(salary) FROM employees WHERE job_id = 'FI_ACCOUNT';
Question 19
Complete
Mark 2.00 out of 2.00
Flag question
Question text
Display all location id between 1000 to 2000.
Select one:
a. DISPLAY location_id FROM departments WHERE location_id LING 1000 UP TO 2000
b. DISPLAY location_id FROM departments WHERE location_id BETWEEN 1000 TO 2000
c. SELECT location_id FROM departments WHERE location_id IN 1000 AND 2000
d. SELECT location_id FROM departments WHERE location_id BETWEEN 1000 AND 2000
Question 20
Complete
Mark 2.00 out of 2.00
Flag question
Question text
What will be the SQL command if every employee will be given a productivity bonus which is equivalent
to 3% of the monthly salary?
Display the employee id, salary and the productivity bonus.
Select one:
a. SELECT employee_id, salary, salary + (salary .03) FROM employees
b. SELECT employee_id, salary, salary * .03 FROM employees
c. SELECT employee_id, salary, salary * 1.03 FROM employees
d. SELECT employee_id, salary FROM employees WHERE salary)
e. SELECT employee_id, salary, salary * .30 FROM employees
Question 21
Complete
Mark 2.00 out of 2.00
Flag question
Question text
Display the employee id, salary, number of years and the hiring date of every employee in the company.
Select one:
a. SELECT employee_id,salary, hire_date, hire_date- SYSDATE /365 FROM employees;
b. SELECT employee_id, salary, hire_date, ROUND((SYSDATE - hire_date) /365,0) FROM employees;
c. SELECT employee_id, salary, hire_date, hire_date /365 FROM employees;
Question 22
Complete
Mark 2.00 out of 2.00
Flag question
Question text
Display the employee's name, job title, job_id and the department name of employees with department id
of 100.
Select one:
a. SELECT E.employee_id, J.job_title, e.job_id, D.department_name
FROM employees E
JOIN jobs J ON E.job_id = J.job_id
JOIN departments D ON E.department_id = D.department_id
WHERE E.department_id = 100
b. SELECT E.employee_id, J.job_title, e.job_id, D.department_name
FROM employees E
JOIN department D ON E.job_id = J.job_id
JOIN jobs J ON E.department_id = D.department_id
WHERE E.department_id = 100
c. SELECT E.employee_id, J.job_title, e.job_id, D.department_name
FROM jobs J
INNER JOIN department D ON E.job_id = J.job_id
INNER JOIN employees EON E.department_id = D.department_id
WHERE E.department_id = 100
d. SELECT E.employee_id, J.job_title, e.job_id, D.department_name
FROM jobs J
NATURAL JOIN department D ON E.job_id = J.job_id
NATURAL JOIN employees E ON E.department_id = D.department_id
WHERE E.department_id = 100
Question 23
Complete
Mark 2.00 out of 2.00
Flag question
Question text
In creating Joins,the NATURALJOIN and USING clauses are____________
Select one:
a. Mutually Inclusive
b. Limited to 2 relational tables
c. Opposite
d. Mutually Exclusive
Question 24
Complete
Mark 4.00 out of 4.00
Flag question
Question text
Display employee id, lastname, firstname, department name, annual salary, location id of employees
whose location id is 1700 and working in Finance Department. Label the annual salary to ANNUAL
SALARY.
Sort the output in from highest to lowest salary. (4 POINTS)
Select one:
a. SELECT E.employee_id, E.last_name, E.first_name, D.department_name, E.salary*12 AS "ANNUAL
SALARY", D.location_id
FROM employees E
NATURAL JOIN jobs J ON E.job_id = J.job_id
NATURAL JOIN departments D ON E.department_id = D.department_id
ORDER BY "ANNUAL SALARY" DESC
WHERE D.location_id = 1700 AND D.department_name = 'Finance'
b. SELECT E.employee_id, E.last_name, E.first_name, D.department_name, E.salary*12 AS "ANNUAL
SALARY", D.location_id
FROM employees E
JOIN jobs J ON E.job_id = J.job_id
JOINemployees E ON E.department_id = D.department_id
WHERE D.location_id = 1700 AND D.department_name = 'Finance'
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
FROM employees E
JOIN jobs J ON E.job_id = J.job_id
JOIN departments D ON E.department_id = D.department_id
WHERE D.location_id = 1700 AND D.department_name = 'Finance'
ORDER BY "ANNUAL SALARY" DESC
d. SELECT E.employee_id, E.last_name, E.first_name, D.department_name, E.salary*12 AS "ANNUAL
SALARY", D.location_id
FROM employees E
OUTER JOIN jobs J ON E.job_id = J.job_id
OUTER JOIN departments D ON E.department_id = D.department_id
WHERE D.location_id = 1700 AND D.department_name = 'Finance'
ORDER BY "ANNUAL SALARY" DESC
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 order.
SELECT first_name, last_name, salary FROM employees WHERE department_id = 100 AND salary < 8000
ORDER BY salary
Display employee's name and id whose firstname starts with letter D and job id is SA_REP. Sort the output by
department.
SELECT employee_id, first_name, last_name FROM employees WHERE first_name LIKE 'D%' and job_id =
'IT_PROG' ORDER BY department_id
List all the employee_id of all employees whose salary is 5000 and below and belong to department 60 or
100.
SELECT employee_id,salary, department_id FROM employees WHERE salary < 5000 AND department_id IN
(60,100)
----------------------------------------
SQ2
Display all the records sorted by price from most expensive to the cheapest parts.
SELECT * FROM parts ORDER BY price DESC
Display all the records whose stock is below 20 and in warehouse number 3.
SELECT * FROM parts WHERE onhand< 20 AND warehouse = 3;
Ronnie is the stockman in the warehouse of ATR Corporation. The General Manager wants to know the parts
whose price is above 10000 and above. Which of the following SQL command that Ronnie will run to
generate the list.
SELECT * 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');
----------------------------------------
LA3
Display the first 5 letter in the surname of all the employees whose firstname starts with letter 'D'
SELECT SUBSTR(last_name,1,5), first_name FROM employees WHERE SUBSTR(first_name,1,1) = 'D'
Display the employee id, number of years and the hiring date of every employee in the company.
SELECT employee_id, hire_date, ROUND((SYSDATE - hire_date) /365,0) FROM employees;
Every employee will get a bonus of 150% of his/her current salary. Display the employee id, salary and the
bonus of every employee. Label the computed bonus with Bonus
The correct answer is: SELECT employee_id, salary, salary * 1.5 AS Bonus FROM employees
----------------------------------------
SQ3
Display the montly salary of every employee. Round the salary in 2 decimal places.
SELECT ROUND( (salary/12),2 ) FROM employees;
Display the total number of characters of the last name of all the employees.
SELECT LENGTH(last_name) FROM employees;
Display the first 3 letter in the first name of all the employees.
SELECT SUBSTR(first_name,1,3) FROM employees;
Display the last day of the month and the hiring date when the employees are hired in the company.
SELECT LAST_DAY(hire_date), hire_date FROM employees;
----------------------------------------
LA4
You want to display the employee id and the year when an employee was hired.
Which SQL statement give the required output?
SELECT employee_id, TO_CHAR(hire_date,'YYYY') FROM employees;
You want to display the employee id and the month an employee was hired.
Which SQL statement give the required output?
SELECT employee_id, hire_date, TO_CHAR(hire_date,'Month') AS "Hired Month" FROM employees;
You want to display the employee's last name whose salary is below 10,000.
Which SQL statement give the required output format of the salary?
Required output :
SELECT last_name, TO_CHAR(salary, '$999,999.99') AS "MONTHLY SALARY" FROM employees WHERE
salary < 10000
----------------------------------------
SQ4
You want to display the last name and the year when an employee was hired whose job id is IT_PROG.
Which SQL statement give the required output?
SELECT last_name, TO_CHAR(hire_date,'YYYY') FROM employees WHERE job_id = ‘IT_PROG’;
You want to display all the employee id and the month an employee was hired excluding employees whose
job id is AD_VP. Which SQL statement give the required output?
SELECT employee_id, hire_date, TO_CHAR(hire_date,'Month') AS "Hired Month", job_id FROM employees
WHERE job_id NOT IN ('AD_VP');
You want to display the employee's id and formatted date hired as shown below.
Which SQL statement give the required output?
Required output :
SELECT employee_id, TO_CHAR(hire_date, 'fmMonth DD, YYYY') AS "Hired Date" FROM employees;
----------------------------------------
LA5
The General Manager request to the Database Administrator to generate the total salary per month of every
department in the company.
SELECT department_id, SUM(salary) FROM employees GROUP BY department_id
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 AVG(salary) FROM employees WHERE job_id = 'IT_PROG';
Aldrin wants to know the highest salary in every department. Which of the following SQL command will
display the required output?
SELECT department_id, MAX(salary) FROM employees 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;
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 < 10000;
----------------------------------------
LQ1
John want to know how many part items are there in warehouse number 3.
What SQL command he need to run?
SELECT COUNT(*) FROM parts WHERE warehouse = 3;
Which of the following SQL command will display all records with part number contains the number 9?
SELECT * from parts WHERE partnum LIKE '%9%'
There was 10% price increase in the all the parts in warehouse number 3. The Store Manager asked the
Database Administrator to generate a report showing the part number, the old and new price.
Which of the following SQL statement would satisfy the requirement of the Store Manager.
SELECT partnum, price, price * 1.1 FROM parts WHERE warehouse = 3
Which of the following SQL command will display the summary table showing the total quantity on hand per
class.
SELECT class, sum(onhand) AS "QTY ON HAND" FROM parts GROUP BY class
Aldrin wants to know the outstanding total balance on hand on every class per warehouse.
SELECT warehouse, class, sum(onhand) FROM parts GROUP BY warehouse, class
----------------------------------------
LA6
The HR Manager instruct the Database Officer to display employee's name and the minimum and maximum
salary the employee can received. Which of the following SQL command will generate the output?
SELECT first_name, last_name, job_id, min_salary, max_salary FROM employees JOIN jobs USING (job_id);
----------------------------------------
SQ6
Display the location id of all employee's name and salary whose salary is from 5000 to 10000.
SELECT first_name, last_name, salary FROM employees JOIN departments USING (department_id) WHERE
salary >= 5000 AND salary <= 10000
----------------------------------------
LA7
A new department name Training with department id 300 was created in the company. This will be managed
by a Manager with ID of 203 and will located at location id 2400.
Create a SQL command to update the information in the department table.
INSERT INTO departments VALUES (300, 'Training', 203, 2400)
Create a SQL command to add a new position Database Administrator with job id of DB_ADMIN whose
salary ranges from 10,000 to 18,000.
INSERT INTO jobs VALUES ('DB_ADMIN', 'Database Administrator', 10000, 18000)
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 Developer', 7000, 8000)
Add a 500 pesos increase in salary of all employees who have rendered services 10 years and above.
UPDATE employees SET salary = salary + 500 where TO_CHAR(sysdate,'YYYY') - TO_CHAR(hire_date,'YYYY')
>= 10
Which of the following will erase all records in the departments table
TRUNCATE TABLE departments
Nathaniel had accidentally deleted all the records in the newly updated ORACLE database using the DELETE
SQL command. What is the best solution that he can do to restore all the deleted records in the database.
Run the ROLLBACK command
----------------------------------------
LA8
Which of the following will grant a query privileges on the STUDENT table
GRANT select ON student TO matt
You want to cancel the privilege of matt to add records from the employees table.
REVOKE insert ON employees FROM matt;
This has the highest level of privileges for task such as creating new users, removing users and tables and
backing up tables.
DBA
----------------------------------------
SQ8
TRUE OR FALSE.
An owner has all the privileges on the object.
True
Which of the following SQL command that the DBA will run to provide Matt to create a table in the Oracle
Database.
GRANT create table TO matt
----------------------------------------
1st Q Exam
What is the SQL command to count the number of records in the employees table?
SELECT COUNT(*) FROM employees
What will be the SQL command if every employee will be given a productivity bonus which is equivalent to
3% of the monthly salary?
Display the employee id, salary and the productivity bonus.
SELECT employee_id, salary, salary * .03 FROM employees
Display the employee id, salary, number of years and the hiring date of every employee in the company.
SELECT employee_id, salary, hire_date, ROUND((SYSDATE - hire_date) /365,0) FROM employees;
You what to generate the average salary of all employees whose job function is FI_ACCOUNT.
Which of the following SQL command will produce the output.
SELECT AVG(salary) FROM employees WHERE job_id = 'FI_ACCOUNT';
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 job_title FROM jobs WHERE min_salary >= 5000 AND max_salary<= 10000
Austin David was transferred to Purchasing Department. You are assigned to update the database.
Which of the following SQL command will satisfy the requirements?
UPDATE employees SET department_id = 30 WHERE first_name = ‘David’ AND last_name = ‘Austin’
Display the lastname of every employee in the company. Display the output in a single column and label it as
Fullname
Format: JuanReyes
SELECT CONCAT(first_name, last_name) AS Fullname 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
You want to generate the total salary per month of every department in the company.
SELECT department_id, SUM(salary) FROM employees GROUP BY department_id
You want to display the employee's last name whose salary is below 10,000 and whose lastname starts with
letter D.
Which SQL statement give the required output format of the salary?
SELECT last_name, TO_INTEGER(salary, $999,999.99) AS "MONTHLY SALARY" FROM employees WHERE
salary < 10000 WHERE last_name IN 'D%'
Display employee id, lastname, firstname, department name, annual salary, location id of employees whose
location id is 1700 and working in Finance Department. Label the annual salary to ANNUAL SALARY.
Sort the output in from highest to lowest salary. (4 POINTS)
SELECT E.employee_id, E.last_name, E.first_name, D.department_name, E.salary*12 AS "ANNUAL
SALARY", D.location_id
FROM employees E
JOIN jobs J ON E.job_id = J.job_id
JOIN departments D ON E.department_id = D.department_id
WHERE D.location_id = 1700 AND D.department_name = 'Finance'
ORDER BY "ANNUAL SALARY" DESC
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 query_emp
(p_last_name IN employees.last_name%TYPE,
p_first_name IN employees.first_name%TYPE,
p_employee_id OUT employees.employee_id%TYPE,
p_salary OUT employees.salary%TYPE) IS
BEGIN
SELECT employee_id, salary INTO p_employee_id, p_salary
FROM employees
WHERE last_name = p_last_name AND first_name = p_first_name;
END query_emp;
What is the default parameter mode when no mode is specified?
Answer: IN
You can use this procedure to issue user-defined error messages from stored subprograms.
Answer: RAISE_APPLICATION_ERROR
Which of the following syntax to declare EXCEPTION named e_invalid_id?
Answer: e_invalid_id EXCEPTION;
When an exception is predefined by Oracle server, the exception is raised ____________ .
Answer: Explicitly
When an exception is user defined, the exception is raised ____________ .
Answer: Explicitly
You can trap any error by including a corresponding handler within the exception-handling section
of the PL/SQL block.
Answer: True
5 END;
Answer: The PL/SQL will delete employee number 114.
Which of the following PL/SQL that will display the total number employees whose salary is 10000
and above?
Answer: DECLARE
v_salary employees.salary%TYPE := 10000;
BEGIN
SELECT COUNT(*) INTO v_salary FROM employees WHERE salary >= v_salary;
DBMS_OUTPUT.PUT_LINE(v_salary);
END;
This is a type of cursor which is created and managed internally by the Oracle server to process SQL
statements
Answer: Implicit
You have been tasked to update the database by creating a PL/SQL to increase the salary of all IT
Programmer employees by twice of their existing salary. Which of the following will execute
successfully?
Answer: DECLARE
v_job_id employees.job_id%TYPE := 'IT_PROG';
BEGIN
UPDATE employees SET salary = salary * 2 WHERE job_id = v_job_id;
END;
You want to display the department name the same with the location of the Purchasing department.
Answer: SELECT department_name from departments where location_id = (SELECT location_id
from departments where department_name = 'Purchasing')
You want to display all records in the database whose salary is above the salary of Alexander
Hunold.
Answer: SELECT * from employees WHERE salary < (SELECT salary FROM employees WHERE
first_name = 'Alexander' AND last_name = 'Hunold')
You want to display all employee id, name, hired date and salary who are hired after employee 104
was hired.
Answer: SELECT employee_id, last_name, hire_date, salary FROM employees WHERE
TO_NUMBER(TO_CHAR(hire_date, 'YYYY')) >
(SELECT TO_NUMBER(TO_CHAR(hire_date, 'YYYY')) FROM employees WHERE employee_id
= 104)
Question 1
Complete
Mark 2.00 out of 2.00
Flag question
Question text
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 >= 5000 AND max_salary<= 10000
b. SELECT job_title FROM employees WHERE salary >= 5000 AND salary <= 10000
c. SELECT employees_id, job_title FROM employees WHERE salary >= 5000 AND salary <= 10000
d. SELECT job_title FROM jobs WHERE salary >= 5000 AND salary <= 10000
Question 2
Complete
Mark 2.00 out of 2.00
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;
Question 3
Complete
Mark 2.00 out of 2.00
Flag question
Question text
True or False. The AND, OR, NOT are comparison operators.
Select one:
True
False
Question 4
Complete
Mark 2.00 out of 2.00
Flag question
Question text
Evaluate the following SQL command
SELECT * FROM jobs WHERE job_title LIKE 'Manager%'
Select one:
a. The SQL command will produce an error.
b. The SQL command will display all employees with Manager position
c. The SQL command will display all records in the database
d. No records will be displayed
Question 5
Complete
Mark 2.00 out of 2.00
Flag question
Question text
You want to display all the employee id and the month an employee was hired.
Which SQL statement give the required output?
Select one:
a. SELECT employee_id, hire_date, TO_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 FROM
employees
c. SELECT employee_id, hire_date, TO_CHAR(hire_date,'Month') AS "Hired Month", job_id FROM
employees
d. SELECT employee_id, hire_date, TO_MONTH(hire_date,'Month') AS "Hired Month", job_id FROM
employees
Question 6
Complete
Mark 2.00 out of 2.00
Flag question
Question text
You want to generate the total salary per month of every department in the company.
Select one:
a. SELECT department_id, salary FROM employees ORDER BY SUM(salary)
b. SELECT department_id, TOTAL(salary) FROM employees GROUP BY department_id
c. SELECT department_id, salary FROM employees GROUP BY SUM(salary) ORDER BY
department_id
d. SELECT department_id, SUM(salary) FROM employees GROUP BY department_id
Question 7
Complete
Mark 2.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.
Which SQL statement give the required output format of the salary?
Select one:
a. SELECT last_name, TO_INT(salary, '$999,999.99') AS "MONTHLY SALARY" FROM employees
WHERE salary < 10,000 WHERE last_name STARTS 'D%'
b. SELECT last_name, TO_CHAR(salary, '$999,999.99') AS "MONTHLY SALARY" FROM employees
WHERE salary < 10000 WHERE last_name LIKE 'D%'
c. SELECT last_name, TO_INTEGER(salary, $999,999.99) AS "MONTHLY SALARY" FROM
employees WHERE salary < 10000 WHERE last_name IN 'D%'
d. SELECT last_name, TO_NUMBER(salary, '$999,999.99') AS "MONTHLY SALARY" FROM
employees WHERE salary < 10,000 WHERE last_name = ‘D%’
Question 8
Complete
Mark 2.00 out of 2.00
Flag question
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
Select one:
a. None of the choices
b. SELECT CONCATENATE(first_name, last_name) AS Fullname FROM employees
c. SELECT CONCAT(first_name, last_name) FROM employees
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
Display the first 5 letter in the surname of all the employees whose firstname starts with letter 'N'
Select one:
a. SELECT SUBSTR(last_name,1,5), first_name FROM employees WHERE first_name IN 'N'
b. SELECT SUBSTR(last_name,1,5), first_name FROM employees WHERE SUBSTR(first_name,1,1) =
'N'
c. SELECT SUBSTR(surname,1,5), first_name FROM employees WHERE SUBSTR(first_name,1,1) IN
'N'
d. SELECT SUBSTR(surname,1,5), first_name FROM employees WHERE first_name = 'N'
e. SELECT SUBSTR(last_name,1,5), first_name FROM employees WHERE SUBSTR(first_name,1,1)
IN 'N'
Question 10
Complete
Mark 2.00 out of 2.00
Flag question
Question text
Austin David was transferred to Purchasing Department. You are assigned to update the database.
Which of the following SQL command will satisfy the requirements?
Select one:
a. UPDATE first_name = ‘David’ AND last_name = ‘Austin’ FROM employees SET department_id = 30
b. UPDATE department_id = 30 WHERE first_name = ‘David’ AND last_name = ‘Austin’
c. UPDATE employees WHERE department_id = 30 SET first_name = ‘David’ AND last_name = ‘Austin’
d. UPDATE employees SET department_id = 30 WHERE first_name = ‘David’ AND last_name = ‘Austin’
Question 11
Complete
Mark 2.00 out of 2.00
Flag question
Question text
John want to know how many employees receiving salary below 10,000.
What SQL command he need to run?
Select one:
a. SELECT COUNT(*) FROM employees WHERE salary < 10000;
b. SELECT COUNT(salary) FROM employees WHERE salary < 10,000;
c. SELECT COUNT(emp_id) FROM employees WHERE salary <= 10000;
d. SELECT salary FROM COUNT(employees)WHERE salary < 10000;
Question 12
Complete
Mark 2.00 out of 2.00
Flag question
Question text
Evaluate the following SQL command
SELECT employee_id, salary, department_id FROM employees WHERE department_id IN (60,70)
Select one:
a. The SQL command will produce an error.
b. The SQL command will display employees with department id 60 and 70.
c. The SQL command will give an incorrect output.
d. The SQL command will display employees with department id 60 or 70.
Question 13
Complete
Mark 2.00 out of 2.00
Flag question
Question text
You want to display the employee's last name and date hired in year 2000 to2006 whose salary is above
5000. Which SQL statement give the required output?
Select one:
a. SELECT last_name, hire_date FROM employees WHERE hire_date>=
TO_DATE('01-Jan-2006', 'DD-Mon-RR') AND hire_date<= TO_DATE('31-Dec-2006', 'DD-Mon-RR') AND
salary > 5000;
b. SELECT last_name, hire_date FROM employees WHERE hire_date>=
TO_DATE('Jan-2000', 'Month-YYYY') AND hire_date<= TO_DATE('Dec-2006', 'Month-‘YYYY') AND
salary > 5,000;
c. SELECT last_name, hire_date FROM employees WHERE hire_date>=
TO_DATE('01-Jan-2000', 'DD-Mon-YYYYY') AND hire_date<= TO_DATE('31-Dec-2006', 'DD-Mon-
YYYY') AND salary ABOVE 5000;
d. SELECT last_name, hire_date FROM employees WHERE hire_date>=
TO_DATE('2000', 'YYYY') AND hire_date<= TO_DATE('2006', 'YYYY') OR salary > 5000;
Question 14
Complete
Mark 2.00 out of 2.00
Flag question
Question text
List all employees except for IT_PROG job id.
Select one:
a. SELECT *FROM employees EXCEPT JOB_ID != 'IT_PROG'
b. SELECT *FROM employees WHERE JOB_ID NOT IN ('IT_PROG')
c. SELECT *FROM employees WHERE JOB_ID <> 'IT_PROG'
d. All of the choices
Question 15
Complete
Mark 2.00 out of 2.00
Flag question
Question text
Evaluate the following SQL command
SELECT employee_id, min_salary, max_salary FROM employees, departments WHERE
salary>= 10000 && salary <= 20000
Select one:
a. The SQL will produce Cartesian Product
b. The SQL will display the employee id, department id and the minimum and maximum salary whose
salary is between 10000 and 20000.
c. The SQL command will produce an error.
d. The SQL command will give an incorrect output.
Question 16
Complete
Mark 2.00 out of 2.00
Flag question
Question text
Display all the records in the employee table. Arrange the output in by lastname from A-Z order.
Select one:
a. SELECT * FROM employees SORT BY lastname
b. SELECT * FROM employees ORDER BY lastname
c. SELECT * FROM employees ORDER BY lastname AZ
d. SELECT * FROM employees SORT BY lastname ascending
Question 17
Complete
Mark 2.00 out of 2.00
Flag question
Question text
Display employee's name and id whose firstname starts with letter D and job id is IT_PROG.
Sort the output by department.
Select one:
a. SELECT employee_id, first_name, last_name FROM employees ORDER BY department_id WHERE
first_name LIKE 'D%' and job_id = 'IT_PROG'
b. SELECT employees FROM employee_id, first_name, last_name WHERE first_name LIKE ‘D%’ and
job_id = ‘IT_PROG’ ORDER BY department_id
c. SELECT employee_id, first_name, last_name FROM employees WHERE job_id = 'IT_PROG' OR
first_name LIKE 'D%' and ORDER BY department_id
d. SELECT employee_id, first_name, last_name FROM employees WHERE first_name LIKE 'D%' and
job_id = 'IT_PROG' ORDER BY department_id
Question 18
Complete
Mark 2.00 out of 2.00
Flag question
Question text
You what to generate the average salary of all employees whose job function is FI_ACCOUNT.
Which of the following SQL command will produce the output.
Select one:
a. SELECT AVERAGE(salary) FROM employees WHERE job_id = 'FI_ACCOUNT';
b. SELECT AVG(salary) FROM employees WHERE job_id = 'FI_ACCOUNT';
c. SELECT AVE(salary) FROM employees WHERE job_id = 'FI_ACCOUNT';
d. SELECT COUNT AVG(salary) FROM employees WHERE job_id = 'FI_ACCOUNT';
Question 19
Complete
Mark 2.00 out of 2.00
Flag question
Question text
Display all location id between 1000 to 2000.
Select one:
a. DISPLAY location_id FROM departments WHERE location_id LING 1000 UP TO 2000
b. DISPLAY location_id FROM departments WHERE location_id BETWEEN 1000 TO 2000
c. SELECT location_id FROM departments WHERE location_id IN 1000 AND 2000
d. SELECT location_id FROM departments WHERE location_id BETWEEN 1000 AND 2000
Question 20
Complete
Mark 2.00 out of 2.00
Flag question
Question text
What will be the SQL command if every employee will be given a productivity bonus which is equivalent
to 3% of the monthly salary?
Display the employee id, salary and the productivity bonus.
Select one:
a. SELECT employee_id, salary, salary + (salary .03) FROM employees
b. SELECT employee_id, salary, salary * .03 FROM employees
c. SELECT employee_id, salary, salary * 1.03 FROM employees
d. SELECT employee_id, salary FROM employees WHERE salary)
e. SELECT employee_id, salary, salary * .30 FROM employees
Question 21
Complete
Mark 2.00 out of 2.00
Flag question
Question text
Display the employee id, salary, number of years and the hiring date of every employee in the company.
Select one:
a. SELECT employee_id,salary, hire_date, hire_date- SYSDATE /365 FROM employees;
b. SELECT employee_id, salary, hire_date, ROUND((SYSDATE - hire_date) /365,0) FROM employees;
c. SELECT employee_id, salary, hire_date, hire_date /365 FROM employees;
Question 22
Complete
Mark 2.00 out of 2.00
Flag question
Question text
Display the employee's name, job title, job_id and the department name of employees with department id
of 100.
Select one:
a. SELECT E.employee_id, J.job_title, e.job_id, D.department_name
FROM employees E
JOIN jobs J ON E.job_id = J.job_id
JOIN departments D ON E.department_id = D.department_id
WHERE E.department_id = 100
b. SELECT E.employee_id, J.job_title, e.job_id, D.department_name
FROM employees E
JOIN department D ON E.job_id = J.job_id
JOIN jobs J ON E.department_id = D.department_id
WHERE E.department_id = 100
c. SELECT E.employee_id, J.job_title, e.job_id, D.department_name
FROM jobs J
INNER JOIN department D ON E.job_id = J.job_id
INNER JOIN employees EON E.department_id = D.department_id
WHERE E.department_id = 100
d. SELECT E.employee_id, J.job_title, e.job_id, D.department_name
FROM jobs J
NATURAL JOIN department D ON E.job_id = J.job_id
NATURAL JOIN employees E ON E.department_id = D.department_id
WHERE E.department_id = 100
Question 23
Complete
Mark 2.00 out of 2.00
Flag question
Question text
In creating Joins,the NATURALJOIN and USING clauses are____________
Select one:
a. Mutually Inclusive
b. Limited to 2 relational tables
c. Opposite
d. Mutually Exclusive
Question 24
Complete
Mark 4.00 out of 4.00
Flag question
Question text
Display employee id, lastname, firstname, department name, annual salary, location id of employees
whose location id is 1700 and working in Finance Department. Label the annual salary to ANNUAL
SALARY.
Sort the output in from highest to lowest salary. (4 POINTS)
Select one:
a. SELECT E.employee_id, E.last_name, E.first_name, D.department_name, E.salary*12 AS "ANNUAL
SALARY", D.location_id
FROM employees E
NATURAL JOIN jobs J ON E.job_id = J.job_id
NATURAL JOIN departments D ON E.department_id = D.department_id
ORDER BY "ANNUAL SALARY" DESC
WHERE D.location_id = 1700 AND D.department_name = 'Finance'
b. SELECT E.employee_id, E.last_name, E.first_name, D.department_name, E.salary*12 AS "ANNUAL
SALARY", D.location_id
FROM employees E
JOIN jobs J ON E.job_id = J.job_id
JOINemployees E ON E.department_id = D.department_id
WHERE D.location_id = 1700 AND D.department_name = 'Finance'
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
FROM employees E
JOIN jobs J ON E.job_id = J.job_id
JOIN departments D ON E.department_id = D.department_id
WHERE D.location_id = 1700 AND D.department_name = 'Finance'
ORDER BY "ANNUAL SALARY" DESC
d. SELECT E.employee_id, E.last_name, E.first_name, D.department_name, E.salary*12 AS "ANNUAL
SALARY", D.location_id
FROM employees E
OUTER JOIN jobs J ON E.job_id = J.job_id
OUTER JOIN departments D ON E.department_id = D.department_id
WHERE D.location_id = 1700 AND D.department_name = 'Finance'
ORDER BY "ANNUAL SALARY" DESC
Question 1
Answer saved
Marked out of 1.00
Remove flag
Question text
You can relate data to multiple tables using a foreign key.
Select one:
True
False
Question 2
Answer saved
Marked out of 1.00
Remove flag
Question text
Which of the following SELECT statement is the correct report that will deduct 5 from ONHAND, multiply
5 in WAREHOUSE, after getting the value on both ONHAND and WAREHOUSE add their data: as
shown below: ONHAND - 5 + 5 * WAREHOUSE
Note that you have to force the Oracle to prioritize first the Subtraction over Multiplication. List only the
column DESCRIPTION, ONHAND and WAREHOUSE.
Select one:
a. SELECT (ONHAND-5) + 5(* WAREHOUSE), DESCRIPTION FROM PARTS;
b. SELECT ONHAND-5 + 5 * WAREHOUSE, DESCRIPTION FROM PARTS;
c. SELECT (ONHAND-5) + 5 * WAREHOUSE, DESCRIPTION FROM PARTS;
d. SELECT ONHAND-5 + 5 (* WAREHOUSE), DESCRIPTION FROM PARTS;
Question 3
Answer saved
Marked out of 1.00
Flag question
Question text
INSERT, DELETE, UPDATE are ________________ commands
Select one:
a. DCL
b. DML
c. DDL
d. All of the choices
Question 4
Answer saved
Marked out of 1.00
Flag question
Question text
What will be the SQL command if every employee will be given a productivity bonus which is equivalent
to 3% of the monthly salary?
Display the employee id, salary and the productivity bonus.
Select one:
a. SELECT employee_id, salary, salary * .03 FROM employees
b. SELECT employee_id, salary, salary * .30 FROM employees
c. SELECT employee_id, salary, salary * 1.03 FROM employees
d. SELECT employee_id, salary, salary + (salary .03) FROM employees
e. SELECT employee_id, salary FROM employees WHERE salary)
Question 5
Answer saved
Marked out of 1.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 K.
Which SQL statement give the required output format of the salary?
Select one:
a. SELECT last_name, TO_CHAR(salary, '$999,999.99') AS "MONTHLY SALARY" FROM
employees WHERE salary < 10000WHERE last_name LIKE ‘K%’
b. SELECT last_name, TO_NUMBER(salary, '$999,999.99') AS "MONTHLY SALARY" FROM
employees WHERE salary < 10,000WHERE last_name = ‘K%’
c. SELECT last_name, TO_INTEGER(salary, $999,999.99) AS "MONTHLY SALARY" FROM
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%'
Question 6
Answer saved
Marked out of 1.00
Remove flag
Question text
Which of the following is the correct report that will display the CLASS from table PARTS.
Select one:
a. SELECT * CLASS FROM PARTS;
b. SELECT CLASS AS CLASS FROM PARTS;
c. SELECT 'CLASS' FROM PARTS;
d. SELECT CLASS FROM PARTS;
Question 7
Answer saved
Marked out of 1.00
Remove flag
Question text
Evaluate the following SQL command
SELECT employee_id, salary, department_id FROM employees WHERE department_id IN (60,70)
Select one:
a. The SQL command will display employees with department id 60 or 70.
b. The SQL command will give an incorrect output.
c. The SQL command will produce an error.
d. The SQL command will display employees with department id 60 and 70.
Question 8
Answer saved
Marked out of 1.00
Remove flag
Question text
You what to generate the average salary of all employees whose job function is FI_ACCOUNT.
Which of the following SQL command will produce the output.
Select one:
a. SELECT AVG(salary) FROM employees WHERE job_id = 'FI_ACCOUNT';
b. SELECT AVE(salary) FROM employees WHERE job_id = 'FI_ACCOUNT';
c. SELECT AVERAGE(salary) FROM employees WHERE job_id = 'FI_ACCOUNT';
d. SELECT COUNT AVG(salary) FROM employees WHERE job_id = 'FI_ACCOUNT';
Question 9
Answer saved
Marked out of 1.00
Remove flag
Question text
Evaluate the following SQL command
SELECT employee_id, min_salary, max_salary FROM employees, departments WHERE
salary>= 10000 && salary <= 20000
Select one:
a. The SQL will produce Cartesian Product
b. The SQL will display the employee id, department id and the minimum and maximum salary
whose salary is between 10000 and 20000.
c. The SQL command will give an incorrect output.
d. The SQL command will produce an error.
Question 10
Answer saved
Marked out of 1.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.
Which SQL statement give the required output format of the salary?
Select one:
a. SELECT last_name, TO_INTEGER(salary, $999,999.99) AS "MONTHLY SALARY" FROM
employees WHERE salary < 10000 WHERE last_name IN 'D%'
b. SELECT last_name, TO_INT(salary, '$999,999.99') AS "MONTHLY SALARY" FROM employees
WHERE salary < 10,000 WHERE last_name STARTS 'D%'
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, '$999,999.99') AS "MONTHLY SALARY" FROM
employees WHERE salary < 10,000 WHERE last_name = ‘D%’
Question 11
Answer saved
Marked out of 1.00
Flag question
Question text
Which of the following will is the correct command to create a role.
Select one:
a. CREATE ROLE gen_manager
b. None of the choices
c. GRANT ROLE gen_manager
d. CREATE gen_manager ROLE
Question 12
Answer saved
Marked out of 1.00
Flag question
Question text
What is the SQL command to display the date of the first employee that was hired?
Select one:
a. SELECT FIRST(hire_date) FROM employees;
b. SELECT hire_date FROM employees WHERE TO_CHAR(hire_date) = ‘FIRST’;
c. SELECT MIN(hire_date) FROM employees;
d. SELECT hire_date FROM employees WHERE FIRST(hire_date );
Question 13
Answer saved
Marked out of 1.00
Flag question
Question text
You want to display the employee id and the year when an employee was hired.
Which SQL statement give the required output?
Select one:
a. SELECT employee_id, YEAR(hire_date,'YYYY') FROM employees;
b. SELECT employee_id, YEAR(hire_date') FROM employees;
c. SELECT employee_id, TO_YEAR(hire_date,'YYYY') FROM employees;
d. SELECT employee_id, TO_CHAR(hire_date,'YYYY') FROM employees;
Question 14
Answer saved
Marked out of 1.00
Remove flag
Question text
Evaluate the following SQL command
SELECT employee_id, hire_date, department_name FROM employees, departments
WHERE departments.department_id = employees.department_id
Select one:
a. The SQL command will produce an error.
b. The SQL command will give an incorrect output.
c. The SQL command should have ALIAS for the table to produce a correct output.
d. The SQL command will produce a correct output.
Question 15
Answer saved
Marked out of 1.00
Remove flag
Question text
Display all the records whose stock is below 20 and in warehouse number 3.
Select one:
a. SELECT * FROM parts WHERE onhand< 20 OR warehouse = 3;
b. SELECT * FROM parts WHERE onhand> 20 OR warehouse = 3;
c. SELECT * FROM parts WHERE onhand< 20 AND warehouse = 3;
d. SELECT * FROM parts WHERE onhand<= 20 AND warehouse = 3;
e. SELECT ALL FROM parts WHERE onhand< 20 AND warehouse = 3;
f. SELECT ALL FROM parts WHERE onhand<= 20 AND warehouse = 3;
Question 16
Answer saved
Marked out of 1.00
Flag question
Question text
TRUE OR FALSE.
A FOREIGN KEY is a field in one table that refers to the PRIMARY KEY in another table.
Select one:
True
False
Question 17
Answer saved
Marked out of 1.00
Flag question
Question text
INDEX is an example of _____________________ privilege.
Select one:
a. System
b. None of the choices
c. Object
d. Data
Question 18
Answer saved
Marked out of 1.00
Flag question
Question text
Ms. Ella what to generate the average salary of all employees whose job function is IT_PROG.
Which of the following SQL command will produce the output.
Select one:
a. SELECT AVERAGE(salary) FROM employees WHERE job_id = 'IT_PROG';
b. SELECT AVE(salary) FROM employees WHERE job_id = 'IT_PROG';
c. SELECT AVG(salary) FROM employees WHERE job_id = 'IT_PROG';
d. SELECT COUNT AVG(salary) FROM employees WHERE job_id = 'IT_PROG';
Question 19
Answer saved
Marked out of 1.00
Flag question
Question text
A _______________ consists of a collection of DML statements that form a logical unit of work.
Select one:
a. All of the choices
b. Transaction
c. SQL command
d. Database
Question 20
Answer saved
Marked out of 1.00
Remove flag
Question text
Which of the following SELECT statement is the correct PL/SQL that will display all rows and columns?
Select one:
a. SELECT TABLE PARTS;
b. SELECT FROM TABLE PARTS;
c. SELECT * FROM PARTS;
d. SELECT ALL FROM PARTS;
Question 21
Answer saved
Marked out of 1.00
Remove flag
Question text
Display all the records in the employee table. Arrange the output in by lastname from A-Z order.
Select one:
a. SELECT * FROM employees SORT BY lastname
b. SELECT * FROM employees ORDER BY lastname AZ
c. SELECT * FROM employees ORDER BY lastname
d. SELECT * FROM employees SORT BY lastname ascending
Question 22
Answer saved
Marked out of 1.00
Flag question
Question text
Austin David was transferred to Purchasing Department. You are assigned to update the database.
Which of the following SQL command will satisfy the requirements?
Select one:
a. UPDATE first_name = ‘David’ AND last_name = ‘Austin’ FROM employees SET department_id =
30
b. UPDATE employees SET department_id = 30 WHERE first_name = ‘David’ AND last_name =
‘Austin’
c. UPDATE department_id = 30 WHERE first_name = ‘David’ AND last_name = ‘Austin’
d. UPDATE employees WHERE department_id = 30 SET first_name = ‘David’ AND last_name =
‘Austin’
Question 23
Answer saved
Marked out of 1.00
Flag question
Question text
The General Manager request to the Database Administrator to generate the total number of parts and
total outstanding balance on hand of every class in warehouse number 1&2.
Which of the following SQL command will generate the required output.
Select one:
a. SELECT warehouse, class, count(partnum), sum(onhand) GROUP BY warehouse,class HAVING
warehouse = 1 or warehouse = 2 FROM parts;
b. SELECT warehouse, class, count(partnum), sum(onhand) GROUP BY warehouse,class WHERE
warehouse = 1 or warehouse = 2 FROM parts;
c. SELECT warehouse, class, SUM(partnum), SUM(onhand) FROM parts GROUP BY
warehouse,class HAVING warehouse = 1 AND warehouse = 2;
d. SELECT warehouse, class, COUNT(partnum), SUM(onhand) FROM parts GROUP BY
warehouse,class HAVING warehouse = 1 OR warehouse = 2;
Question 24
Answer saved
Marked out of 1.00
Flag question
Question text
John want to know how many employees receiving salary below 10,000.
What SQL command he need to run?
Select one:
a. SELECT COUNT(salary) FROM employees WHERE salary < 10,000;
b. SELECT COUNT(*) FROM employees WHERE salary < 10000;
c. SELECT salary FROM COUNT(employees)WHERE salary < 10000;
d. SELECT COUNT(emp_id) FROM employees WHERE salary <= 10000;
Question 25
Answer saved
Marked out of 1.00
Flag question
Question text
What privileges that manipulates the content of the database objects.
Select one:
a. Object Privileges
b. Connection Privileges
c. Network Privileges
d. System Privileges
Question 26
Answer saved
Marked out of 1.00
Remove flag
Question text
Each row of data in a table can be uniquely identified by a
Select one:
a. foreign key
b. primary key
c. local key
d. relational key
e. index key
Question 27
Answer saved
Marked out of 1.00
Flag question
Question text
You want to display all the job position titles whose salary is salary from 5,000 to 12,000 arrange from
highest to lowest
Select one:
a. SELECT job_title FROM employees WHERE salary >= 5000 AND salary <= 10000
b. SELECT employees_id, job_title FROM employees WHERE salary >= 5000 AND salary <=
10000
c. SELECT job_title FROM jobs WHERE salary >= 5000 AND salary <= 10000
d. SELECT job_title FROM jobs WHERE min_salary >= 5000 AND max_salary<= 10000
Question 28
Answer saved
Marked out of 1.00
Remove flag
Question text
Display all location id between 1000 to 2000.
Select one:
a. DISPLAY location_id FROM departments WHERE location_id LING 1000 UP TO 2000
b. SELECT location_id FROM departments WHERE location_id IN 1000 AND 2000
c. DISPLAY location_id FROM departments WHERE location_id BETWEEN 1000 TO 2000
d. SELECT location_id FROM departments WHERE location_id BETWEEN 1000 AND 2000
Question 29
Answer saved
Marked out of 1.00
Flag question
Question text
You want to display the employee's last name and date hired in year 2002 whose salary is above 5000.
Which SQL statement give the required output?
Select one:
a. SELECT last_name, hire_date FROM employees WHERE hire_date >= TO_DATE('01-Jan-2000',
'DD-Mon-YYYYY') AND hire_date <= TO_DATE('31-Dec-2002', 'DD-Mon-YYYY')AND salary ABOVE
5000;
b. SELECT last_name, hire_date FROM employees WHERE hire_date >= TO_DATE('01-Jan-2002',
'DD-Mon-RR') AND hire_date <= TO_DATE('31-Dec-2002', 'DD-Mon-RR') AND salary > 5000;
c. SELECT last_name, hire_date FROM employees WHERE hire_date >= TO_DATE('2000',
'YYYY') AND hire_date <= TO_DATE('2002', 'YYYY') OR salary > 5000;
d. SELECT last_name, hire_date FROM employees WHERE hire_date >= TO_DATE('Jan-2000',
'Month-YYYY') AND hire_date <= TO_DATE('Dec-2002', 'Month-‘YYYY') AND salary > 5,000;
Question 30
Answer saved
Marked out of 1.00
Flag question
Question text
There was 10% price increase in the all the parts in warehouse number 3. The Store Manager asked the
Database Administrator to generate a report showing the part number, the old and new price.
Which of the following SQL statement would satisfy the requirement of the Store Manager.
Select one:
a. SELECT partnum, price, price * 0.1 FROM parts WHERE warehouse = 3
b. SELECT partnum, price, price * 10% FROM parts WHERE warehouse = 3
c. SELECT partnum, price, price * 1.1 FROM parts WHERE warehouse = 3
d. SELECT partnum, price, price * 1.10% FROM parts WHERE warehouse = 3
Question 31
Answer saved
Marked out of 1.00
Remove flag
Question text
You want to display the employee's last name and date hired in year 2000 to2006 whose salary is above
5000. Which SQL statement give the required output?
Select one:
a. SELECT last_name, hire_date FROM employees WHERE hire_date>=
TO_DATE('01-Jan-2000', 'DD-Mon-YYYYY') AND hire_date<= TO_DATE('31-Dec-2006', 'DD-Mon-
YYYY') AND salary ABOVE 5000;
b. SELECT last_name, hire_date FROM employees WHERE hire_date>=
TO_DATE('01-Jan-2006', 'DD-Mon-RR') AND hire_date<= TO_DATE('31-Dec-2006', 'DD-Mon-RR') AND
salary > 5000;
c. SELECT last_name, hire_date FROM employees WHERE hire_date>=
TO_DATE('Jan-2000', 'Month-YYYY') AND hire_date<= TO_DATE('Dec-2006', 'Month-‘YYYY') AND
salary > 5,000;
d. SELECT last_name, hire_date FROM employees WHERE hire_date>=
TO_DATE('2000', 'YYYY') AND hire_date<= TO_DATE('2006', 'YYYY') OR salary > 5000;
Question 32
Answer saved
Marked out of 1.00
Remove flag
Question text
Which of the following SQL commands will display all the stocks on hand from 10 to 30?
Select one:
a. SELECT * FROM parts WHERE BETWEEN onhand = 10 AND onhand = 30;
b. SELECT * FROM parts WHERE onhand BETWEEN 10 to 30;
c. SELECT * FROM onhand WHERE parts BETWEEN onhand = 10 AND onhand = 30;
d. SELECT * FROM parts WHERE onhand BETWEEN 10 AND 30;
e. SELECT * FROM parts WHERE BETWEEN onhand>=10 to onhand<=30;
Question 33
Answer saved
Marked out of 1.00
Flag question
Question text
ANSI SQL commands cannot be abbreviated.
Select one:
True
False
Question 34
Answer saved
Marked out of 1.00
Remove flag
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
Select one:
a. SELECT CONCATENATE(first_name, last_name) AS Fullname FROM employees
b. None of the choices
c. SELECT CONCAT(first_name, last_name) FROM employees
d. SELECT CONCAT(first_name, last_name) AS Fullname FROM employees
Question 35
Answer saved
Marked out of 1.00
Remove flag
Question text
Evaluate the following SQL command
SELECT * FROM jobs WHERE job_title LIKE 'Manager%'
Select one:
a. The SQL command will display all records in the database
b. The SQL command will display all employees with Manager position
c. No records will be displayed
d. The SQL command will produce an error.
Question 36
Answer saved
Marked out of 1.00
Flag question
Question text
Aldrin wants to know the highest salary in every department. Which of the following SQL command will
display the required output?
Select one:
a. SELECT department_id, HIGH(salary) FROM employees GROUP BY department_id AND salary;
b. SELECT department_id, HIGHEST(salary) FROM employees GROUP BY salary;
c. SELECT department_id, MAX(salary) FROM employees GROUP BY department_id
d. SELECT department_id, MAXIMUM(salary) FROM employees GROUP BY department_id;
Question 37
Answer saved
Marked out of 1.00
Remove flag
Question text
You want to display all the employee id and the month an employee was hired.
Which SQL statement give the required output?
Select one:
a. SELECT employee_id, hire_date, TO_MONTH(hire_date,'Month') AS "Hired Month", job_id
FROM employees
b. SELECT employee_id, hire_date, TO_DATE(hire_date,'Month') AS "Hired Month", job_id FROM
c. SELECT employee_id, hire_date, MONTH(hire_date,'Month') AS "Hired Month", job_id FROM
employees
d. SELECT employee_id, hire_date, TO_CHAR(hire_date,'Month') AS "Hired Month", job_id FROM
employees
Question 38
Answer saved
Marked out of 1.00
Flag question
Question text
Which of the following describes the command below?
SELECT * FROM employees WHERE department = 60 FOR UPDATE
Select one:
a. Locks the rows in the EMPLOYEES table with department id is 60.
b. Unlock all records with department id = 60
c. All users accessing the department id 60 can accept UPDATE command simultaneously.
d. Creates a temporary table with department = 60
Question 39
Answer saved
Marked out of 1.00
Flag question
Question text
Display the employee id, number of years and the hiring date of every employee in the company.
Select one:
a. SELECT employee_id, hire_date, ROUND((SYSDATE - hire_date),0 /365,0) FROM employees;
b. SELECT employee_id, hire_date, ROUND((SYSDATE - hire_date) /365,0) FROM employees;
c. SELECT employee_id, hire_date, hire_date /365 FROM employees;
d. SELECT employee_id, hire_date, hire_date- SYSDATE /365 FROM employees;
Question 40
Answer saved
Marked out of 1.00
Flag question
Question text
The DBA will create a new user name sales.
Which of the following SQL command will perform the creation?
Select one:
a. CREATE USER FR0M DB_USER SET user=’sales’ password=NULL
b. None of the choices
c. CREATE USERNAME sales SET PASSWORD default
d. CREATE sales ACCESS 1234
e. CREATE USER sales IDENTIFIED BY 1234
Question 41
Answer saved
Marked out of 1.00
Flag question
Question text
Which of the following SQL command will display the summary table showing the total quantity on hand
per class.
Select one:
a. SELECT class, TOTAL(onhand) AS "QTY ON HAND" FROM parts GROUP BY class, onhand
b. SELECT class, onhand AS "QTY ON HAND" FROM parts GROUP BY sum(onhand)
c. SELECT class, sum(onhand) AS "QTY ON HAND" FROM parts GROUP BY onhand
d. SELECT class, sum(onhand) AS "QTY ON HAND" FROM parts GROUP BY class
Question 42
Answer saved
Marked out of 1.00
Remove flag
Question text
Display the first 5 letter in the surname of all the employees whose firstname starts with letter 'N'
Select one:
a. SELECT SUBSTR(last_name,1,5), first_name FROM employees WHERE
SUBSTR(first_name,1,1) IN 'N'
b. SELECT SUBSTR(last_name,1,5), first_name FROM employees WHERE
SUBSTR(first_name,1,1) = 'N'
c. SELECT SUBSTR(surname,1,5), first_name FROM employees WHERE first_name = 'N'
d. SELECT SUBSTR(surname,1,5), first_name FROM employees WHERE SUBSTR(first_name,1,1)
IN 'N'
e. SELECT SUBSTR(last_name,1,5), first_name FROM employees WHERE first_name IN 'N'
Question 43
Answer saved
Marked out of 1.00
Flag question
Question text
Display the employee id, salary, number of years and the hiring date of every employee in the company.
Select one:
a. SELECT employee_id,salary, hire_date, hire_date- SYSDATE /365 FROM employees;
b. SELECT employee_id, salary, hire_date, hire_date /365 FROM employees;
c. SELECT employee_id, salary, hire_date, ROUND((SYSDATE - hire_date) /365,0) FROM
employees;
Question 44
Answer saved
Marked out of 1.00
Flag question
Question text
True or False. The AND, OR, NOT are comparison operators.
Select one:
True
False
Question 45
Answer saved
Marked out of 1.00
Flag question
Question text
You want to display all the employee id and the month an employee was hired excluding employees
whose job id is AD_VP. Which SQL statement give the required output?
Select one:
a. SELECT employee_id, hire_date, MONTH(hire_date,'Month') AS "Hired Month",
job_id FROM employees WHERE job_id EXCLUDE ('AD_VP');
b. SELECT employee_id, hire_date, TO_CHAR(hire_date,'Month') AS "Hired Month", job_id FROM
employees WHERE job_id NOT IN ('AD_VP');
c. SELECT employee_id, hire_date, TO_MONTH(hire_date,'Month') AS "Hired Month", job_id
FROM employees WHERE job_id NOT ('AD_VP');
d. SELECT employee_id, hire_date, TO_DATE(hire_date,'Month') AS "Hired Month", job_id FROM
employees WHERE job_id NOT = 'AD_VP';
Question 46
Answer saved
Marked out of 1.00
Remove flag
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:
a. SELECT employees FROM employee_id, first_name, last_name WHERE first_name LIKE ‘D%’
and job_id = ‘IT_PROG’ ORDER BY department_id
b. SELECT employee_id, first_name, last_name FROM employees WHERE job_id = 'IT_PROG' OR
first_name LIKE 'D%' and ORDER BY department_id
c. SELECT employee_id, first_name, last_name FROM employees 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
Question 47
Answer saved
Marked out of 1.00
Flag question
Question text
TRUE OR FALSE.
An owner has all the privileges on the object.
Select one:
True
False
Question 48
Answer saved
Marked out of 1.00
Flag question
Question text
You want to generate the total salary per month of every department in the company.
Select one:
a. SELECT department_id, SUM(salary) FROM employees GROUP BY department_id
b. SELECT department_id, salary FROM employees ORDER BY SUM(salary)
c. SELECT department_id, salary FROM employees GROUP BY SUM(salary) ORDER BY
department_id
d. SELECT department_id, TOTAL(salary) FROM employees GROUP BY department_id
Question 49
Answer saved
Marked out of 1.00
Flag question
Question text
Which of the following SQL commands will display all stocks whose class is HW or AP.
Select one:
a. SELECT * FROM parts WHERE IN (class = ‘HW’, class= ‘AP’);
b. SELECT ALL FROM class WHERE parts IN = (‘HW’, ‘AP’);
c. SELECT * FROM parts WHERE IN class ('HW', 'AP');
d. SELECT ALL FROM parts WHERE IN class = (‘HW’, ‘AP’);
e. SELECT * FROM parts WHERE class IN ('HW', 'AP');
Question 50
Answer saved
Marked out of 1.00
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;
Which of the following SELECT statement is the correct report that will
display the unique value for WAREHOUSE renames the column as "No. of
ER
employees WHERE job_id = 'IT_PROG' Display the employee id and the last name of every employee
in the
single column with the format 100 : King Label the column as Employee
Select one:
class in warehouse number 1&2. Which of the following SQL command will generate the required
output. SELECT warehouse, class, SUM(partnum), SUM(onhand) FROM parts
You want to display the employee’s last name whose salary is below 10,000 and
whose lastname starts with le er K. Which SQL statement give the required output format of the
salary?
Select one:
SALARY" FROM employees WHERE salary < 10,000WHERE last_name = ‘K%’ Display the employee's
name, job title, job_id and the department
FROM employees E
Evaluate the following PL/SQL. Which of the following will line creates an
error?
2. (
7. IS
8. BEGIN
p_department_id ;
No error
7. END query_employee
No error
You want to know the total number of employees whose rstname starts
1. DECLARE
2. v_ rst_name VARCHAR2(50);
3. v_last_name VARCHAR2(50);
4. v_salary INTEGER(20);
5. BEGIN
6. SELECT rst_name, last_name, salary INTO v_ rst_name, v_last_name, v_salary FROM employees
WHEREdepartment_id =
60;
10. END;
No Error. A join between two tables that returns the results of an INNER
join as well as the results of a left and right join is a _____________. NATURAL JOIN
Umpdate the Purchasing department name to Procurement. And this will be anaged by the
Manager of Administration department. Select one:
100FROM departments WHERE department_name = 'Treasury' Evaluate the given SQL syntax
WHERE condition;
Display the employee id and the last name of every employee in the
single column with the format 100 : King Label the column as Employee
Select one:
CREATE
Given the DEPARTMENTS table and USER user1, evaluate the SQL
command:
GRANT select ON user1
TO departments
create an access for the newly hired employee named Matt to the Oracle
Display employee's name and id whose rstname starts with letter D and
job id is IT_PROG. Sort the output by department. SELECT employee_id, rst_name, last_name
FROM employees WHERE
You want to display the employee’s last name whose salary is below 10,000 and
whose lastname starts with le er K. Which SQL statement give the required output format of the
salary?
‘K%’Which of the following SELECT statement is the correct report that will
to STOCK?
FROM PART;
Display a summary table of the total quantity on hand above 50 very class per warehoused.
ANSWER :
SELECT warehouse, class, sum(onhand) FROM parts GROUP BY warehouse,class HAVING SUM(ONHAND) >
50
Display the warehouse number, class, highest price & lowest price, total on hand balance
whose class is AP.
Sort the output by warehouse number.
Select one:
a. SELECT warehouse, class, MAX(price), MIN(PRICE), sum(onhand)
FROM parts
WHERE class = 'AP'
GROUP BY warehouse, class
ORDER BY warehouse;
Question 1
Answer saved
Marked out of 1.00
Flag question
Question text
You want to display the last name and the year when an employee was hired whose job id is
IT_PROG.
Which SQL statement give the required output?
Select one:
a. SELECT last_name, TO_YEAR(hire_date,'YYYY') FROM employees WHERE job_id =
‘IT_PROG’;
b. SELECT last_name, YEAR(hire_date') FROM employees WHERE job_id = ‘IT_PROG’;
c. SELECT last_name, YEAR(hire_date,'YYYY') FROM employees WHERE job_id =
‘IT_PROG’;
d. SELECT last_name, TO_CHAR(hire_date,'YYYY') FROM employees WHERE job_id =
‘IT_PROG’;
Question 2
Answer saved
Marked out of 1.00
Flag question
Question text
You want to display the employee id and the month an employee was hired.
Which SQL statement give the required output?
Required output :
Select one:
a. SELECT employee_id, hire_date, MONTH(hire_date) AS "Hired Month" FROM employees;
b. SELECT employee_id, TO_MONTH(hire_date,'Month') AS 'Hired Month'FROM employees;
c. SELECT employee_id, hire_date, TO_CHAR(hire_date,'Month') AS "Hired Month" FROM
employees;
d. SELECT employee_id, DATE(hire_date,'Month') AS 'Hired Month'FROM employees;
Question 3
Answer saved
Marked out of 1.00
Flag question
Question text
You want to display all the employee id and the month an employee was hired excluding
employees whose job id is AD_VP. Which SQL statement give the required output?
Select one:
a. SELECT employee_id, hire_date, TO_MONTH(hire_date,'Month') AS "Hired Month", job_id
FROM employees WHERE job_id NOT ('AD_VP');
b. SELECT employee_id, hire_date, TO_CHAR(hire_date,'Month') AS "Hired Month", job_id
FROM employees WHERE job_id NOT IN ('AD_VP');
c. SELECT employee_id, hire_date, TO_DATE(hire_date,'Month') AS "Hired Month", job_id
FROM employees WHERE job_id NOT = 'AD_VP';
d. SELECT employee_id, hire_date, MONTH(hire_date,'Month') AS "Hired Month", job_id FROM
employees WHERE job_id EXCLUDE ('AD_VP');
Question 4
Answer saved
Marked out of 1.00
Flag question
Question text
John want to know how many part items are there in warehouse number 3.
What SQL command he need to run?
Select one:
a. SELECT * FROM COUNT(parts) WHERE warehouse = 3;
b. SELECT COUNT(*) FROM parts WHERE warehouse = 3;
c. SELECT ALL FROM COUNT(parts) WHERE warehouse = 3;
d. SELECT partnum FROM COUNT(parts)WHERE warehouse = 3;
Question 5
Answer saved
Marked out of 1.00
Flag question
Question text
You want to display the employee id, date hired of all employees whose hired date is
September.
Which SQL statement give the required output?
Select one:
a. SELECT employee_id, hire_date, TO_DATE(hire_date, 'Month') AS "Hired Month" FROM
employees WHERE TO_DATE(hire_date, 'MON') = 'SEP'
b. SELECT employee_id, hire_date, TO_CHAR(hire_date, 'Month') AS "Hired Month" FROM
employees WHERE TO_CHAR(hire_date, 'Month') = TO_DATE('September')
c. SELECT employee_id, hire_date, TO_CHAR(hire_date, 'Month') AS "Hired Month" FROM
employees WHERE TO_DATE(hire_date, 'Month') = TO_DATE(‘09’)
d. SELECT employee_id, hire_date, TO_CHAR(hire_date, 'Month') AS "Hired Month" FROM
employees WHERE TO_CHAR(hire_date, 'MON') = 'SEP'
Question 6
Answer saved
Marked out of 1.00
Flag question
Question text
Display a summary table of the total quantity on hand above 50 very class per warehouse
Select one:
a. SELECT warehouse, class, sum(onhand) FROM parts GROUP BY warehouse,class
HAVING SUM(ONHAND) > 50
b. SELECT warehouse, class, sum(onhand) FROM parts GROUP BY warehouseWHERE
SUM(ONHAND) > 50
c. SELECT warehouse, class, sum(onhand) FROM parts WHERE SUM(ONHAND) > 50
d. SELECT warehouse, class, sum(onhand) FROM parts GROUP BY warehouse HAVING
SUM(ONHAND) > 50
Question 7
Answer saved
Marked out of 1.00
Flag question
Question text
You want to display the employee's last name and date hired in year 2002 whose salary is
above 5000.
Which SQL statement give the required output?
Select one:
a. SELECT last_name, hire_date FROM employees WHERE hire_date >= TO_DATE('2000',
'YYYY') AND hire_date <= TO_DATE('2002', 'YYYY') OR salary > 5000;
b. SELECT last_name, hire_date FROM employees WHERE hire_date >= TO_DATE('01-Jan-
2002', 'DD-Mon-RR') AND hire_date <= TO_DATE('31-Dec-2002', 'DD-Mon-RR') AND salary >
5000;
c. SELECT last_name, hire_date FROM employees WHERE hire_date >= TO_DATE('01-Jan-
2000', 'DD-Mon-YYYYY') AND hire_date <= TO_DATE('31-Dec-2002', 'DD-Mon-YYYY')AND
salary ABOVE 5000;
d. SELECT last_name, hire_date FROM employees WHERE hire_date >= TO_DATE('Jan-
2000', 'Month-YYYY') AND hire_date <= TO_DATE('Dec-2002', 'Month-‘YYYY') AND salary >
5,000;
Question 8
Answer saved
Marked out of 1.00
Flag question
Question text
John want to know how many employees receiving salary below 10,000. What SQL command
he need to run?
Select one:
a. SELECT salary FROM COUNT(employees)WHERE salary < 10000;
b. SELECT COUNT(salary) FROM employees WHERE salary < 10,000;
c. SELECT COUNT(emp_id) FROM employees WHERE salary <= 10000;
d. SELECT COUNT(*) FROM employees WHERE salary < 10000;
Question 9
Answer saved
Marked out of 1.00
Flag question
Question text
Which of the following SQL command will display the summary table showing the total quantity
on hand per class.
Select one:
a. SELECT class, onhand AS "QTY ON HAND" FROM parts GROUP BY sum(onhand)
b. SELECT class, sum(onhand) AS "QTY ON HAND" FROM parts GROUP BY class
c. SELECT class, TOTAL(onhand) AS "QTY ON HAND" FROM parts GROUP BY class,
onhand
d. SELECT class, sum(onhand) AS "QTY ON HAND" FROM parts GROUP BY onhand
Question 10
Answer saved
Marked out of 1.00
Flag question
Question text
Select one:
a. 85
b. 44
c. 137
d. 178
Question 11
Answer saved
Marked out of 1.00
Flag question
Question text
There was 10% price increase in the all the parts in warehouse number 3. The Store Manager
asked the Database Administrator to generate a report showing the part number, the old and
new price.
Which of the following SQL statement would satisfy the requirement of the Store Manager.
Select one:
a. SELECT partnum, price, price * 1.1 FROM parts WHERE warehouse = 3
b. SELECT partnum, price, price * 0.1 FROM parts WHERE warehouse = 3
c. SELECT partnum, price, price * 1.10% FROM parts WHERE warehouse = 3
d. SELECT partnum, price, price * 10% FROM parts WHERE warehouse = 3
Question 12
Answer saved
Marked out of 1.00
Flag question
Question text
Display the warehouse number, class, highest price & lowest price, total on hand balance
whose class is AP.
Sort the output by warehouse number.
Select one:
a. SELECT warehouse, class, MAX(price), MIN(PRICE), sum(onhand)
FROM parts
WHERE class = 'AP'
GROUP BY warehouse, class
ORDER BY warehouse;
b. SELECT warehouse, class, MAX(price), MIN(PRICE), SUM(onhand)
FROM parts
GROUP BY warehouse, class
ORDER BY warehouse;
WHERE class = 'AP'
c. SELECT warehouse, class, MAX(price), MIN(PRICE), sum(onhand)
FROM parts
WHERE class = 'AP'
GROUP BY warehouse, class, price
ORDER BY warehouse, class
d. SELECT warehouse, class, HIGH(price), LOW(PRICE), SUM(onhand)
FROM parts
GROUP BY warehouse
WHERE class = 'AP'
ORDER BY warehouse, class;
Question 13
Answer saved
Marked out of 1.00
Flag question
Question text
You want to display the employee's last name hired from year 2000 to 2002.
Which SQL statement give the required output?
Select one:
a. SELECT last_name, hire_date FROM employees WHERE hire_date>= TO_DATE('01-Jan-
2000', 'DD-Mon-RR') AND hire_date<= TO_DATE('31-Dec-2002', 'DD-Mon-RR')
b. SELECT last_name, hire_date FROM employees WHERE hire_date>= TO_DATE('Jan-
2000', 'Month-YYYY') AND hire_date<= TO_DATE('Dec-2002', 'Month-‘YYYY')
c. SELECT last_name, hire_date FROM employees WHERE hire_date>= TO_DATE('2000',
'YYYY') AND hire_date<= TO_DATE('2002', 'YYYY')
d. SELECT last_name, hire_date FROM employees WHERE hire_date>= TO_DATE('01-Jan-
2000', 'DD-Mon-YYYYY') AND hire_date<= TO_DATE('31-Dec-2002', 'DD-Mon-YYYY')
Question 14
Answer saved
Marked out of 1.00
Flag question
Question text
Aldrin wants to know the highest salary in every department. Which of the following SQL
command will display the required output?
Select one:
a. SELECT department_id, HIGHEST(salary) FROM employees GROUP BY salary;
b. SELECT department_id, MAXIMUM(salary) FROM employees GROUP BY department_id;
c. SELECT department_id, HIGH(salary) FROM employees GROUP BY department_id AND
salary;
d. SELECT department_id, MAX(salary) FROM employees GROUP BY department_id
Question 15
Answer saved
Marked out of 1.00
Flag question
Question text
The General Manager request to the Database Administrator to generate the total number of
parts and total outstanding balance on hand of every class in warehouse number 1&2.
Which of the following SQL command will generate the required output.
Select one:
a. SELECT warehouse, class, SUM(partnum), SUM(onhand) FROM parts GROUP BY
warehouse,class HAVING warehouse = 1 AND warehouse = 2;
b. SELECT warehouse, class, count(partnum), sum(onhand) GROUP BY warehouse,class
WHERE warehouse = 1 or warehouse = 2 FROM parts;
c. SELECT warehouse, class, COUNT(partnum), SUM(onhand) FROM parts GROUP BY
warehouse,class HAVING warehouse = 1 OR warehouse = 2;
d. SELECT warehouse, class, count(partnum), sum(onhand) GROUP BY warehouse,class
HAVING warehouse = 1 or warehouse = 2 FROM parts;
Question 16
Answer saved
Marked out of 1.00
Flag question
Question text
What is the SQL command to display the date of the first employee that was hired?
Select one:
a. SELECT FIRST(hire_date) FROM employees;
b. SELECT MIN(hire_date) FROM employees;
c. SELECT hire_date FROM employees WHERE TO_CHAR(hire_date) = ‘FIRST’;
d. SELECT hire_date FROM employees WHERE FIRST(hire_date );
Question 17
Answer saved
Marked out of 1.00
Flag question
Question text
Select one:
a. 2 rows returned
b. Invalid SQL command
c. 0 rows returned
d. 7 rows returned
e. Error
Question 18
Answer saved
Marked out of 1.00
Flag question
Question text
Aldrin wants to know the outstanding total balance on hand on every class per warehouse.
Select one:
a. SELECT TOTAL(warehouse), TOTAL(class), TOTAL(onhand) FROM parts GROUP BY
warehouse, class
b. SELECT warehouse, class, onhand FROM parts GROUP BYsum(warehouse), sum(class);
c. SELECT warehouse, class, sum(onhand) FROM parts GROUP BY warehouse, class
d. SELECT warehouse, class, onhand FROM parts GROUP BY warehouse, class
Question 19
Answer saved
Marked out of 1.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 K.
Which SQL statement give the required output format of the salary?
Select one:
a. SELECT last_name, TO_NUMBER(salary, '$999,999.99') AS "MONTHLY SALARY" FROM
employees WHERE salary < 10,000WHERE last_name = ‘K%’
b. SELECT last_name, TO_CHAR(salary, '$999,999.99') AS "MONTHLY SALARY" FROM
employees WHERE salary < 10000WHERE last_name LIKE ‘K%’
c. SELECT last_name, TO_INT(salary, '$999,999.99') AS "MONTHLY SALARY" FROM
employees WHERE salary < 10,000 WHERE last_name STARTS 'K%'
d. SELECT last_name, TO_INTEGER(salary, $999,999.99) AS "MONTHLY SALARY" FROM
employees WHERE salary < 10000 WHERE last_name IN 'K%'
Question 20
Answer saved
Marked out of 1.00
Flag question
Question text
You want to display the employee id and the year when an employee was hired.
Which SQL statement give the required output?
Select one:
a. SELECT employee_id, YEAR(hire_date,'YYYY') FROM employees;
b. SELECT employee_id, TO_YEAR(hire_date,'YYYY') FROM employees;
c. SELECT employee_id, TO_CHAR(hire_date,'YYYY') FROM employees;
d. SELECT employee_id, YEAR(hire_date') FROM employees;
Answer:
Which of the following SQL command will display all records with part number contains the number 9?
Answer:
Ms. Ella what to generate the average salary of all employees whose job functionis IT_PROG. Which of the
following SQL command will produce the output.Select one:
Answer:
You want to display all the employee id and the month an employee was hired excluding employees whose
job id is AD_VP. Which SQL statement give the required output?
Answer:
SELECT employee_id, hire_date, TO_CHAR(hire_date,'Month') AS "Hired Month", job_id FROM employees
WHERE job_id NOT IN ('AD_VP')
FOR select_statement;
[RETURN return_type];
Answer: True
DECLARE
v_amount accumulator;
v_num1 NUMBER;
v_num2 NUMBER;
v_num3 NUMBER;
BEGIN
v_amount := 10.50;
v_num1 := 1;
v_num2 := 2;
v_num3 := 3;
v_num1 := v_amount;
END;
Answer: 18
[,variable_name2,. . .] | record_name;
Answer: True
This is a subset of an existing data type that may place a constraint on its base type.
Answer: Subtype
Use column aliases in cursors for calculated columns fetched into records declared with
%COLUMNTYPE.
Answer: False
Restrictive, specifies a RETURN type, associates only with type-compatible queries are
description of a ________________.
Answer: Use column aliases in cursors for calculated columns fetched into records declared with
%COLUMNTYPE.
This is a subset of an existing data type that may place a constraint on its base type.
Answer: Subtype
Remember,
It’s Jocc.
[1] Yes you can redistribute THIS document, BUT not the PASSWORD (NONEWHATSOEVER
REASON YOU CAN’T INCLUDE THE PASSWORD).
[2] E.G. Using this document for the purpose of (is not limited to) OED Answering
services.
[3] E.G. Uploading this to Coursehero, Scribd, etc. (or alike) for the purpose of
earning access to such websites and self-interest/ self-gain.