Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This problem set will use the emp and dept tables from the ApEx default schema. 1. Create a SELECT statement that will use the CASE

This problem set will use the emp and dept tables from the ApEx default schema.

1. Create a SELECT statement that will use the CASE switch. Give the empno, ename , job along with the location information from the dept table. For instance if deptno is 10 then use the CASE statement to display the string Accounting. Do the same for the three other locations in the dept table. Use dept as the column alias so you dont get:

CASEDEPTNOWHEN10THEN'ACCOUNTING'WHEN20THEN'RESEARCH'WHEN30THEN'SALES'WHEN40THEN'OPERATIONS'END as a column header.

2. Modify the previous query so we get the month and the year someone was hired. Dont show the day that they were hired. Use the to_char() function along with a format mask to return the month and year that they were hired.

3. Modify the SQL query to show the number of years someone has worked for this company by subtracting hiredate from sysdate. Because hiredate is of the date data type you will have to use single row functions to extract the year value.

P.S. The tables are already created.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

More Books

Students also viewed these Databases questions

Question

What are the economic advantages of low-input farming?

Answered: 1 week ago