Problem
Problem
Final Period
Ensuring Quality Query Results
Instructions:
- Read the questions carefully.
- Provide the screenshots of your query and output. (include your full name in each screenshot)
- Write your final answer query in your answer sheet. NO Erasure.
- Total Points: 27 (1 point each)
Screenshot: SQL>
SELECT SUBSTR(first_name,1,1)
Query: || ' ' || last_name
FROM hr.employees;
SQL>
SELECT table_name, owner
FROM all_tables 3. Problem:
WHERE table_name LIKE'JO%' - Create a list of every employee's first
name concatenated to a space and
the employee's last name, and the
2. Problem: email of all employees where the
- Create a list that includes the first email address contains the string 'IN'.
initial of every employee's first name, Tables Used:
- Employees
Answer: 6. Create a list of every employee and his
Query: related job title sorted by job_title.
SQL>
SELECT first_name ||' ' || last_name, • Tables Used: – Employees, Jobs
email
FROM hr.employees Answer:
WHERE email LIKE'%IN%'; Query:
SELECT
SUBSTR(employees.first_name,1,1)
|| ' ' ||
4. Create a list of 'smallest' last name employees.last_name "Employee Name",
and the 'highest' last name from the jobs.job_title "Jobs"
employees table. FROM hr.employees, hr.jobs
WHERE employees.job_id = jobs.job_id;
• Tables Used: – Employees
Output:
Answer:
Query: 7. Create a list of every employee's job,
SELECT the salary ranges within the job, and
last_name AS "First Last Name", the employee's salary. – List the
last_name AS "Last Last Name" lowest and highest salary range within
FROM hr.employees each job with a dash to separate the
ORDER BY "First Last Name" ASC, "Last salaries like this: 100 – 200.
Last Name" DESC;
• Tables Used: – Employees, Jobs
Output:
Answer:
5. Create a list of weekly salaries from the Query:
employees table where the weekly SELECT
salary is between 700 and 3000. – The SUBSTR(employees.first_name,1,1)
salaries should be formatted to include || ' ' ||
a $-sign and have two decimal points employees.last_name "Employee Name",
like: $9999.99. jobs.job_title "Jobs",
MIN_SALARY ||'-'|| MAX_SALARY
• Tables Used: – Employees "Salary Range",
employees.salary "Employee's Salary"
Answer: FROM hr.employees, hr.jobs
Query: WHERE employees.job_id = jobs.job_id;
SELECT
TO_CHAR(ROUND(salary/4,2), Output:
'fm$99,999.00')
AS "Weekly Salary" 8. Using an ANSII join method, create a
FROM hr.employees list of every employee's first initial and
WHERE salary BETWEEN 700 AND last name, and department name. –
3000; Make sure the tables are joined on all
Output:
of the foreign keys declared between SELECT DECODE (manager_id,
the two tables. null,'Nobody','Somebody') "Works For",
last_name "Last Name"
• Tables Used: – Employees, FROM hr.employees;
Departments Output:
Answer:
Query:
SELECT
SUBSTR(first_name,1,1)
|| ' ' ||
last_name "Employee Name",
department_name "Department Name"
FROM hr.employees e JOIN
hr.departments d
ON(e.department_id = d.department_id);
Output: