Question

Suppose all the employees got promoted on January 1, 2000. Write an SQL query that will...

Suppose all the employees got promoted on January 1, 2000. Write an SQL query that will output first name, last name, salary, department and date (in a specific format) columns from the Employees table. The first column will be the employee’s first name, the second column will be the employee’s last name, the third column will be the current salary and the fourth column will show the 'Updated salary' of the employees. The updated salary column will be calculated as per the below format and condition. The salary will be doubled if an employee has been associated with the company for more than 10 years (01-JAN-2000 - hire date). If the employee has been associated with the company for more than five years but less than ten years, the salary is increased by 50 percent. Otherwise, the salary is increased by 20 percent. Order the rows as per the department ID keeping the null values on the top of the output.

Homework Answers

Answer #1

If you have any doubts, please give me comment...

SELECT FirstName, LastName, Salary AS "Current Salary", CASE

WHEN EXTRACT(YEAR FROM HireDate) - EXTRACT(YEAR FROM TO_DATE('01-JAN-2000', 'DD-MON-YYYY')) >10 THEN Salary*2

WHEN EXTRACT(YEAR FROM HireDate) - EXTRACT(YEAR FROM TO_DATE('01-JAN-2000', 'DD-MON-YYYY')) THEN Salary*1.5

WHEN EXTRACT(YEAR FROM HireDate) - EXTRACT(YEAR FROM TO_DATE('01-JAN-2000', 'DD-MON-YYYY')) THEN Salary*1.2

END AS "Updated Salary", DepartmentID, HireDate

FROM Employees

ORDER BY DepartmentID;

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Oracle Assingment Introduction to databases Topics :Restricting and sorting data Create a query to display the...
Oracle Assingment Introduction to databases Topics :Restricting and sorting data Create a query to display the last name and salary of employees earning more than 1200 Display the last name and salary for all employees whose salary is not in the range of 5,000 and 10,000 Display the employee last name, job ID, and start date of employees hired between February 20, 1998, and May 1, 1998. Order the query in ascending order by start date. Display the last name...
Write a SQL statement which joins the parts table with the supplier table and lists the...
Write a SQL statement which joins the parts table with the supplier table and lists the part_name, supplier_name for all parts in the part table. The supplier_id column in the suppliers table is the primary key in the suppliers table, and this key has been exported to the parts table where it is a foreign key. You should use an inner join for this query. Write a SQL statement which joins the parts table with the suppliers table and lists...
EMPLOYEE Field Name EMP_ID EMP_LNAME EMP_MI EMP_FNAME EMP_SEX EMP_AGE EMP_SALARY EMP_HIREDATE DEPT_CODE Table: DEPARTMENT DEPT_CODE BIOL...
EMPLOYEE Field Name EMP_ID EMP_LNAME EMP_MI EMP_FNAME EMP_SEX EMP_AGE EMP_SALARY EMP_HIREDATE DEPT_CODE Table: DEPARTMENT DEPT_CODE BIOL CPTR HIST MATH RELB Data Type Text Text Text Text Text Number Currency Date/Time Text DEPT_TITLE Biology Computer Science History Mathematics Religion    Field Name DEPT_CODE DEPT_TITLE Data Type Text Text INSTRUCTIONS Use SQL commands to create the tables and enter the data shown above using MS Access. Write the following SQL statement given below: 1. 2. 3. 4. 5. 6. 7. 8. 9....
I am using Oracle HR. Write a query to display the last name of employees, length...
I am using Oracle HR. Write a query to display the last name of employees, length of the name, and first monday since the hire date. Make the query that the user is prompted to enter a letter that the last name start with by using a substitution variable for the letter. For example, if the user enters "H" or "h" when prompted, the output should show all employees whose start with letter H and make sure that the case...
Using the Company database in Oracle, construct SQL queries for the following (note: I will make...
Using the Company database in Oracle, construct SQL queries for the following (note: I will make the files to create and populate the Company database available on Isadore shortly): List the last name and address of managers who have a dependent with the same first name as themselves. Retrieve the names of all employees who are directly supervised by ‘Franklin Wong’. Retrieve the names of employees in the Research department who work more than 20 hours per week on the...
Specify the following queries in SQL on the COMPANY database. Show the result of each query....
Specify the following queries in SQL on the COMPANY database. Show the result of each query. Retrieve the names of all employees in department 5 who work more than 10 hours per week on the ‘ProductX’ project. List the names of all employees who have a dependent with the same first name as themselves. Find the names of all employees who are directly supervised by ‘Franklin Wong’. Specify the following updates using the SQL update commands. Show the state of...
1) Add to a relational table DEPARTMENT information about the total number of employees in each...
1) Add to a relational table DEPARTMENT information about the total number of employees in each department. Note, that if a department has not employee then for such a department the total number of employees must be set to zero (0). The total number of employees must be a positive number no more than 999. Use SELECT statement to list the contents of an extended relational table DEPARTMENT in the descending order of the total number of employees. Finally, remove...
SQL Write the queries necessary to obtain the required information 1) Use sub query and “in”...
SQL Write the queries necessary to obtain the required information 1) Use sub query and “in” keyword to print the salesreps (ids) who have taken order for the companies ‘Zetacorp’ or ‘JCP Inc.’ . Duplicate rows are not allowed 2) Use sub query to find the id and the name of every sales rep that represents at least one customer with a credit limit of greater than $5000. 3) Use sub query and keyword “exists” to list the id and...
Prevosti Farms and Sugarhouse pays its employees according to their job classification. The following employees make...
Prevosti Farms and Sugarhouse pays its employees according to their job classification. The following employees make up Sugarhouse's staff: Employee Number Name and Address Payroll information A-Mille Thomas Millen Hire Date: 2-1-2019 1022 Forest School Rd DOB: 12-16-1982 Woodstock, VT 05001 Position: Production Manager 802-478-5055 PT/FT: FT, exempt SSN: 031-11-3456 No. of Exemptions: 4 401(k) deduction: 3% M/S: M Pay Rate: $35,000/year A-Towle Avery Towle Hire Date: 2-1-2019 4011 Route 100 DOB: 7-14-1991 Plymouth, VT 05102 Position: Production Worker 802-967-5873...
On January 1, 2006, Zillionaire (the Company) issued to certain employees 1,000,000 equity-settled stock option awards....
On January 1, 2006, Zillionaire (the Company) issued to certain employees 1,000,000 equity-settled stock option awards. The employees will vest in differing numbers of options depending on the cumulative amount of net income the Company earns over the four fiscal years1 following the date of grant, and their continued employment with the Company. The exercise price of the awards is $31.50, which was the Company’s closing share price on the NASDAQ National Market on the date of grant. The Company...