You are on page 1of 9

TUGAS DADAKAN

6. select substr(first_name,1,1) ||' '|| last_name "Employee Name"

from employees;

7. select first_name ||' '|| last_name "Employee Name",email "Email"

from employees

where EMAIL LIKE'%IN%' AND employee_id IN('100','205');


8. SELECT MIN(last_name) as "first last name" , MAX(last_name) as "last last name"
FROM employees;

9. SELECT TO_CHAR(salary, '$99999.99') as "weekly salary "


FROM employees
WHERE salary BETWEEN 700 AND 3000;
10. select substr(first_name,1,1) ||' '|| last_name "Employee Name", job_title "Job"

from employees natural join jobs;

11. SELECT SUBSTR(first_name, 0, 1) || ' ' || last_name AS "Employee Name", job_title AS "Job" ,

CASE

WHEN job_id = 'AC_MGR' THEN '8200-16000'


WHEN job_id = 'AD_ASST' THEN '3000-6000'

WHEN job_id = 'AD_VP' THEN '15000-30000'

WHEN job_id = 'MK_MAN' THEN '9000-15000'

WHEN job_id = 'MK_REP' THEN '4000-9000'

WHEN job_id = 'AD_PRES' THEN '20000-40000'

WHEN job_id = 'IT_PROG' THEN '4000-10000'

WHEN job_id = 'AC_ACCOUNT' THEN '4200-9000'

WHEN job_id = 'SA_MAN' THEN '10000-20000'

WHEN job_id = 'SA_REP' THEN '6000-12000'

WHEN job_id = 'ST_CLERK' THEN '2000-5000'

WHEN job_id = 'ST_MAN' THEN '5500-8500'

END as "Salary Range" , salary "Employee's Salary"

FROM employees NATURAL JOIN jobs

ORDER BY job_title ASC;

13. select substr(first_name,1,1) ||' '|| last_name "Employee Name", decode(department_id,

110, 'Accounting',

90, 'Executive',
80, 'sales',

60, 'It',

50, 'Shipping',

20, 'Marketing',

10, 'Administration',

'Other dept.') "Department"

from employees

ORDER by department_id Asc;

14. select decode(manager_id,

null, 'Nobody',

'Somebody')

"Works for", last_name "Last Name"

from employees;
16. SELECT last_name, department_name, city, state_province

FROM employees RIGHT OUTER JOIN departments USING (department_id)

JOIN locations USING (location_id)

18.
SELECT employees.Last_name, employees.salary, job_grades.grade_level

FROM employees, job_grades

WHERE (salary BETWEEN lowest_sal AND highest_sal)AND

department_id > 50;


select last_name as "Last_Name"

from employees;

UNIOn

select department_name, city

from departments natural join locations;

You might also like