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

1. Display last name, job title for employees whose commission percentage is not

ID: 3592519 • Letter: 1

Question

1. Display last name, job title for employees whose commission percentage is not null and belongs to department 40.

2- Display department name, manager name, and salary of the manager, for all managers whose commission percentage is not null.

3- Display employees first name, last name, department name and country name .

4- Display department name, average salary and number of employees who have commission within the department.

5- Display details of departments in which the maximum salary is more than 8000.

6- Display first name of manager who manages more than 4 employees.

7- Display employee name, job title, start date, and end date of past jobs of all employees with commission percentage null.

8- Display job ID, job title for the jobs that have average salary more than 10000.

9- Display years (YYYY) in which more than 10 employees joined.

10- Display departments in which more than five employees have commission percentage not null.

11- Display employee ID for employees who did more than one job in the past.

12- Display department ID, year, and total Number of employees joined, order by department ID.

13- Update the salary for employee ID 115 to 8000 if the existing salary is less than 6000.

14- Display country name, city, and department name.

15- Display job title, department name, employee last name, for employees who was hired between year 2000 to 2005 (including 2000 and 2005).

Explanation / Answer

Display details of jobs where the minimum salary is greater than 10000.

SELECT * FROM JOBS WHERE MIN_SALARY > 10000

2.

Display the first name and join date of the employees who joined between 2002 and2005.

SELECT FIRST_NAME, HIRE_DATE FROM EMPLOYEESWHERE TO_CHAR(HIRE_DATE, 'YYYY') BETWEEN 2002 AND 2005 ORDER BYHIRE_DATE

3.

Display first name and join date of the employees who is either IT Programmer or SalesMan.

SELECT FIRST_NAME, HIRE_DATEFROM EMPLOYEES WHERE JOB_ID IN ('IT_PROG', 'SA_MAN')

4.

Display employees who joined after 1st January 2008.

SELECT * FROM EMPLOYEES where hire_date > '01-jan-2008'

5.

Display details of employee with ID 150 or 160.

SELECT * FROM EMPLOYEES WHERE EMPLOYEE_ID in (150,160)

6.

Display first name, salary, commission pct, and hire date for employees with salary lessthan 10000.

SELECT FIRST_NAME, SALARY, COMMISSION_PCT, HIRE_DATE FROM EMPLOYEESWHERE SALARY < 10000

7.

Display job Title, the difference between minimum and maximum salaries for jobs withmax salary in the range 10000 to 20000.

SELECT JOB_TITLE, MAX_SALARY-MIN_SALARY DIFFERENCE FROM JOBS WHEREMAX_SALARY BETWEEN 10000 AND 20000

8.

Display first name, salary, and round the salary to thousands.

SELECT FIRST_NAME, SALARY, ROUND(SALARY, -3) FROM EMPLOYEES

9.

Display details of jobs in the descending order of the title.

SELECT * FROM JOBS ORDER BY JOB_TITLE