Prog113a 1st Semester
Prog113a 1st Semester
Prog113a 1st Semester
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)
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 DOES NOT describes the state of the data after the COMMIT
command
None of the choices
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
3 BEGIN
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