You are on page 1of 2

1/24/24, 8:16 AM Q DB2 - Solve quiz questions for database course

Program: Engineering first Exam Date: 2/04/2018


Professions 2 nd Semester
Major: CSE 3,2 2021/2022 Duration: 20 Minutes
Course: Database Instructor: amjad abo eljedyan

1- Display employees who joined after 1st january 2008.

SELECT *
FROM employees
WHERE hire_date > '1-jan-2008'

2- Display last name salary and hire date of the employees who salary
between 1000 and 5000 and department id is not equal 50.

SELECT last_name , salary , hire_date


FROM employees
WHERE salary BETWEEN 1000 and 5000 and department_id <> 50

3- Display average for commission_pct of the employees.

SELECT AVG( NVL(commission_pct , 0))


FROM employees

4- Display first name , last name , phone number , department id and


commission pct of the employees order by first name.
SELECT first_name , last_name , phone_number , department_id , commission_pct
FROM employees

ORDER BY first_name

about:blank 1/2
1/24/24, 8:16 AM Q DB2 - Solve quiz questions for database course

5- Display the last name , salary and Annual salary multiplied by


commission.

SELECT last_name , salary , salary*12 * NVL(commission_pct , 0)


FROM employees

6- Display count and sum salary for each group job id where sum
salary greater than 5000 and job id equals SH_CLERK , HR_REP ,
AC_MGR , PU_MAN and AD_ASST.

SELECT COUNT(*) , SUM(salary) FROM employees

GROUP BY job_id HAVING sum(salary) > 5000


and job_id in ('SH_CLERK' , 'HR_REP' , 'AC_MGR' , 'PU_MAN' , 'AD_ASST')

7- Display last name and department name Assuming there is more


than one column with the same name.

SELECT e.last_name , d.department_name


FROM employees e JOIN departments d
on(e.department_id = d.department_id)

about:blank 2/2

You might also like