3
SQL Level –1 1)Write a query to list all the employees who are working as clerk 2) Write a query to list the employees who are working as clerks or managers with the minimum salary of 4000 3) Write a query to get the current date 4) Write a query o list the employees who are having experience more than 4 years 5) Write a query to list the employees who hired in the last seven days 6) Write a query to list the employees whose salaries are within the range of 5000 and 10000 7) Write a query to list the employees who have joined in the month of March’99 8) Write a query to list the employees whose salaries are not within the range of 10000 and 13000 9) Write a query who are getting 1000, 2000, 3000 10) Query to list all employees except who are joined on 11- Sep-2001, 31-Mar-2001 and 30-Jan-2001(It also compares time). 11) To list all the employees whose names are having ‘O’ as second character 12) To list all the employees whose names are having ‘R’ as last character 13) To list all the employees whose names are having just 5 characters as length. 14) To list all the employees whose names are starting with ‘R’ and ending with ‘O’

SQL ASSIGNMENT(QUERIES)

Embed Size (px)

DESCRIPTION

Queries in Sql

Citation preview

Page 1: SQL ASSIGNMENT(QUERIES)

SQLLevel –1

1)Write a query to list all the employees who are working as clerk

2) Write a query to list the employees who are working as clerks or managers with the minimum salary of 4000

3) Write a query to get the current date

4) Write a query o list the employees who are having experience more than 4 years

5) Write a query to list the employees who hired in the last seven days

6) Write a query to list the employees whose salaries are within the range of 5000 and 10000

7) Write a query to list the employees who have joined in the month of March’99

8) Write a query to list the employees whose salaries are not within the range of 10000 and 13000

9) Write a query who are getting 1000, 2000, 3000

10) Query to list all employees except who are joined on 11- Sep-2001, 31-Mar-2001 and 30-Jan-2001(It also compares time).

11) To list all the employees whose names are having ‘O’ as second character

12) To list all the employees whose names are having ‘R’ as last character

13) To list all the employees whose names are having just 5 characters as length.

14) To list all the employees whose names are starting with ‘R’ and ending with ‘O’

Level –2

1.Display those employees who's joining of month and grade is equal?

2.Display the half of the ename's in upper case and the remaining in lower case?

3.Use the variable in a statement which finds all employees who can earn $30,000 a year of more?

Page 2: SQL ASSIGNMENT(QUERIES)

4.Find out how many managers are there without listing them?

5.Find out the average salary and average total remuneration for each job type remember salesman earn comm?

6.Find out the job that was filled in the first half of 1983 and same job that was filled during the same period on 1984?

7.Findout all the employees who joined the company before their manager?

8.List out all the employees by name and number along with their managers name and number, also display KING who has no manager?

9.Find out the employees who earn the highest salary in each job type. Sort in descending sal order?

10.Find out the most recently hired employees in each department. Order by hiredate?

11.Display ename salary and deptno for each employee who earn a salary greater than the average for their department order by deptno?

12.Display the department order by deptno?

13.Display the department where there are no employees?

14.Display deptno with highest annual remuneration bill as compensation?

15.Display average salary figure for the department?

16.Display employees who can earn more than lowest salary in department 30?

17.Find employees who can earn more than every employee in department 30?

18.Select department name,deptno and sum of salary?

19.Find all depertments which have more than three employees?

20.List lowest paid employees working for each manager? Exclude any groups where the minimum salary is less than 1000 sort the output by salary?

21.Delete those records from emp table whose deptno not available in dept table?

22.Display name of those emp who are going to retire 31-dec-1999. If the maximum job period is 30 years?

23.Display those emp whose salary is odd value?

24.Display those employees whose salary is contains atleast 3 digits?

Page 3: SQL ASSIGNMENT(QUERIES)

25.Display those emp who join in the company in the month of Dec?

26.Display those emp who's name contains "A"?

27.Display those emp who's deptno is available in salary?

28.Display those emp who's 10% fo salary is equals to the year of joining?

29.Display those emp who joined the company before 15th of the month?

30.Delete those emp who joined company of 10years back from today?

31.Display those emp who are working as manager?