Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. select employee_id,name,department_id, department_name Logic for department_n

ID: 3920801 • Letter: 1

Question

1. select employee_id,name,department_id, department_name
Logic for department_name.
If deptartment_id=10, it should be IT
If deptartment_id=20, it should be SALES
every other department_id should be SERVICES

2. Display employee_id, first_name, phone_number, middle_3 only for employee_id 100 and 177

logic for middle_3= number between first and second dot for phone number
select * from hr.employees
WHERE EMPLOYEE_ID IN (100,177)

ex 100,515.123.4567,123
177,011.44.1644.429264,44
  
3. select employee_id,first_name,new_name
Logic for new_name, replace a with x
ex 101,Neena,Neenx

4. Select employee_id, salary, new_salary
Logic for new salary, remove all zeros from the right side.
ex 100,24000,24
108,12008,12008
  
5. What is 109865 multipled by 78264. Calculate this in Database.

6. What is the version of oracle database you are using. Write a query for that.

7. What is the current time. Write a query for that.

Explanation / Answer

1)

select employee_id,name,department_id,(case

when employee_id=10 then 'IT'

when employee_id=20 then 'SALES'

ELSE 'SERVICES'

END)as department_name from table_name;

3)

SELECT employee_id,first_name,REPLACE(first_name,"a","x") as new_name
FROM table_name;

4)

Given example is not clear............!!!!

5)

SELECT 109865*78264 as ANSWER;

6)

7)

NOW()