P. 1
Post-Clas Exercise (SQL) (1)

Post-Clas Exercise (SQL) (1)

|Views: 19|Likes:
Published by Ali Arslan

More info:

Published by: Ali Arslan on Apr 14, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

09/19/2013

pdf

text

original

Post-Class Exercise (SQL

)

Problem# 1 (Introduction to SQL) 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 1.10 1.11 1.12 1.13 Select all information from SALGRADE table. Select all information from EMP table. List all employees who have a salary between 1000 and 2000. List department numbers and names in department name order. Display all the different job types. List the details of the employees in departments 10 and 20 in alphabetical order of names. List names and jobs of all clerks in department 20. Display all employees names which have TH or LL in them. List details for all employees who have a manager. Display names and total remuneration for all employees. Display all employees who were hired during 1983. Display name, annual salary and commission of all salespeople whose monthly salary is greater than their commission. The output should be ordered by salary, in descending order. Display all employee information in ascending order of manager number. King must be last.

Problem# 2 (Using Functions) This exercise covers functions not just in the SELECT but also in WHERE and ORDER BY clauses. Note the column alias, which have been used. 2.1 2.2 2.3 2.4 2.5 2.6 List the employee name and salary increased by 15% and expressed as a whole number of dollars. Display each employee’s name and hiredate from dept. 20. Display each employee name with hiredate, and salary review date. Assume review date is one year after hiredate. Order the output in ascending review date order. Print a list of employees displaying just the salary amount if more than 1500. If exactly 1500 display ‘On Target’, if less than 1500 display ‘Below 1500’. Write a query which will return the DAY of the week (i.e. MONDAY,) for any date entered in the format: DD.MM.YY. Employees hired on or before the 15th of any month are paid on the last Friday of that month. Those hired after the 15 th are paid on the last Friday of the following month. Print a list of employees, their hiredate and first pay date. Sort on hiredate. Write a query to calculate the length of time any employee has been with the company. Problem# 3 (Joins) 1. Display all employee names and their department name, in department name order. 2. Display all employee names, department number and name.

2.7

12. job salary. Produce a list showing employees’ salary grades. Query result should also show departments who do not have any employees. Find the job that was filled in the first half of 1983. (using left outer join) 4. 16. location and department of employees whose salary is more than 1500 a month. Modify solution to question 10 to display KING who has no manager. Query result should also show each employee who is not part of a department and each department which doesn't have an employee(Full outer Join) 6. 10. Show all employees in Dallas. 7. displaying the highest salary first. grade and department name for everyone in the company except clerks. List the employee name. 11.(using Except) 8. Sort on salary. Display results of query 5 with Union. Find all employees who joined the company before their manager. 15. You need to do this using INTERSECT. 13.(using Right outer Join) 5. Display each employee who is in a department and each department that has an employee. Display All Departments with their Employees. Display employees whose salary is between 1500 and 3000. Query result should also show employees who do not have any department assigned. department number and name. Take Intersection of these two tables.3. Display the employees who salaries are between 1500 to 3000 and those whose salaries are between 4000 to 5000. Display the name. 17. Show only employees on grade 3. Display the department that has no employees. First find the employees whose salaries are between 1000 and 4000. 14. Then find Employees with salaries between 2500 and 4000. 18. and the same job that was filled during the same period in 1984. . 9. List all employees by name and number along with their manager’s name and number. Display all employee names.

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->