Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

SQL Assignment

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 11

1.

Extract all the employee details


Select * from EMP;
2.Extract employee number, name, salary,
commission.
Select EmpNum, EmpName, Sal, Commission from
EMP;
3.Extract employee details whose name is Scott
Select * from EMP where EmpName=Scott;
4.Display the employee no and total salary for all the
employees.
Select EmpNum from EMP,
5.Display the employee name and annual salary for all
employees.
Select EmpName, 12*sal as AnnualSal From Emp;
6. Display the names of all the employees who are
working in depart
number 10.
7. Display the names of all the employees who are
working as clerks and
drawing a salary more than 3000.
8. Display the employee number and name who are
earning comm.
Dell - Internal Use - Confidential

9. Display the employee number and name who do not


earn any comm.
10. display the names of employees who are working as
clerks,salesman or
analyst and drawing a salary more than 3000.
11. Display the list of employcees who have joined the
company before
30-JUN-90 or after 31-DEC-90.
12. Display the names of employees working in depart
number 10 or 20 or
40 or employees working as CLERKS, SALESMAN or
ANALYST.
13. create a table with the table name as sun sys and
with column names eno,ename with the size 9
,job,sal,deptno
14. Display empno,ename,deptno,sal sort the output first
base on name
and within name by deptno and with in deptno by sal.
15. Display the name of the employee along with their
annual salary(sal* 12).The name of the employee earning
highest annual salary should apper first.
16. Display name,salary,hra,pf,da,total salary for each
employee. The output should be in the order of total
salary,hra 15% of salary,da 10% of salary,pf 5%
,salary,total salary will be(salary+hra+da)-pf.
17. Display depart numbers and total number of
employees working in each department.
Dell - Internal Use - Confidential

18. Display the jobs found in department 20 and


Eliminate duplicate jobs.
19. Add a column date of joining to sunsys table (table
existed).
20. I created an table with sunsys. In that I defined an
column ename with the size 9.
Now I want to insert the ename as sun systems .will it
insert successfully?
Otherwise how you can insert that ename sunsys table.
21. Insert the below data into sunsys table.
Empno ename job Sal deptno
1001 king manager 5000 10
1002 jeorge 2300 30
1003 althaf salesman 1570
1004 cashier 2750 40
Try to insert the above data into sun ray table at run
time.
22. Update a column ename with watson, where the
empno is 1004 and update job
With buyer whose ename as George and update deptno
as 20, where the job as
Salesman (do in single query)
SNRIT
SQL
SNRIT suriyanreddyb@ymail.com Page 2

Dell - Internal Use - Confidential

23. Delete all the details of the employee, whose enpno


is 1006 and 1007.
24. Extract all the employee details in salary wise
descending order.
25. Extract all the EMP details in empno wise ascending
and job wise descending order.
26. Extract ename, job of the sunsys table in lower case.
27. Extract ename,job of the sunsys table in upper case
28. Extract ename,job of the sunsys table in initcap case
29. Extract enames with first half letters in lower case
and second half in initcap.
30. Display the data as in the following way for each row
Empnumber is 1001 and his name is OracleImages and
his salary is 9800,he belongs to dept 20
31. Find out the length of all the employee names.
32. Extract all the EMP details with the length of those
names.
33. Find out the position of string a for all enames in
sunsys table.
34. Fetch a string ima from the string oracle images
35. Write a query to display the number 5467.988, by
using number 5467.987453.
36. Write a query to display the number 5467.987, by
using the number 5467.987453.
37. Count the employees, howmany are working in the
organization sun sys.
38. Find out the days, between your birth dates to
todays date.
Dell - Internal Use - Confidential

39. Write a query to display the date as 01-may-2011, by


using the date 01-aug-2011.
40. Write a query to display the date as 01-may-2011, by
using the date 01-jan-2011.
41. Find out the highest salary of sun sys organization.
42. Extract the employee details, whose empnos are
1002 and 1006 and 1007.
43. Extract the EMP details, except the details of
empnos 1002 and 1007.
44. Find out the average salaries for department wise.
45. Find out the total salaries of sun sys organization.
46. Extract the emp details whose salary is between
4356 and 2310.
47. Extract the emp details whose salary is not between
4356 and 2310.
48. Extract the emp details who doesnt have manager.
49. Extract empno, ename, sal, daywiae salary, annual
salary, total income of the month and year.
50. How many weeks are there between the dates 12may-1986 to 12-May-2011.
51. Extract the emp details whose names fourth
character starts withs and ends with a.
52. Find out how many as are in your name.
53. Find out how many as are there in all emp names.
54. Extract the emp details, whose name contain
minimum 2 as.
55. Extract the emp details whose empno contain only
numbers.
56. Extract the emp details whose empno contain only
characters.
Dell - Internal Use - Confidential

57. Extract the emp details whose empno contain


numbers and characters.
58. Extract empno, ename, deptno, dept name of all
employees.
59. Extract empno, ename, deptno, dept name, salary
grade of all employees.
SNRIT
SQL
SNRIT suriyanreddyb@ymail.com Page 3

Dell - Internal Use - Confidential

60. Extract all the rows of the emp, dept, sal grade
tables. (Dont miss any row).
61. Extract employee name and his manager name.
62. Extract all the emp details whose employee salary is
greater than his manager salary.
63. Extract ename, manager name, Sal grade and his
deptno of all employees.
64. Write a query to find out dept wise maximum salary.
65. Write a query to find out, what are the jobs avialable
in the sunsys organization.
66. Extract ename, dept name, dept wise minimum
salary of all employees.
67. Write a query to find out duplicate rows in a table;
68. Write a query to delete duplicate row from a table;
69. Write a query to extract all the departrment details,
which department having atleast 2employees.
70. Extract the employee detail, who is not working
under the department sales.
71. Extract the emp details, who is working under the
departments sales and research.
72. Extract the emp details ,who is working for deptno for
20 and 30 and the empno is not end with the 0 or starts
with 1 and it should contain atleast one 0
In his empno.
73. Extract emp details ename,dname ,whose emp name
contain atleast one a

Dell - Internal Use - Confidential

And his salary between 2189 and 4325 or he belongs to


the deptno 20 or 10
And he is not belongs to the dept operations.
74. Extract the emp detail who is not working under the
manager king (ref: emp table).
75. Calculate and display the experience of all
employees.
76. Extract the emp details, who are senior in your
organization.
77. Extract the emp details, who have joined after
second half of the 1985 year.
78. Extract the emp details, who are having atleast
3years of experience.
79. Extract the emp details, who have joined after
second half of the 1979 year or who are having atleast
16 years of experience and his department name must
contain atlest 5 characters.
80. Extract all the emp details who are joined before the
second half of the 1986 year and the month of his joining
date should be may or month of his joiniung should not
be April, June, July.
81. Extract all the emp details, who is senior than his
manager.
82. Extract the emp details who is joined on the day 15th
or not joined on the month of June, July, August and he
will be junior to his manager and his salary shoild be
greater than his managers salary.
83. Write a query to display all the jobs in your
organization, but atlest three employees need work
under that job.
84. I have data like this.
Dell - Internal Use - Confidential

/Empnumber is... .., 7561 and hisss naaame issa snr


annd... his ---salary isssss Rs:4532.
Write a query to display the above data as like thisSNRIT
SQL
SNRIT suriyanreddyb@ymail.com Page 4

Dell - Internal Use - Confidential

Empnumber is 7561 and his name is snr and his salary is


Rs: 4532.
85. Extract the emp details as ename, dept name,
location, whose ename not starts withs and employee
name should contain 5 characters.and his grade should
be 2 or 3 and he is not belongs to the location dallas
and his joining date of the month sholud not be april or
june and who having three years of experience or he will
be junior to his manager or his manager salary is greater
than his salary.
86. Extract the employee details who are having
maximum day-salary.
87. Extract the emp details with week-salary.
88. Extract the emp details who are not working under
the departments sales and operations or his salary
should be between 1523 to 4352 and he must working
under his manager and his grade will be 2 or 3 and his
department name should not contain the character h
and l and he must joined in the organization before the
second half of the year 1987 or he would not joined on
the month of jun, july of the year 1985.
89. Delete the rows of employees who are working in the
company for more than 2 years.
90. Provide a commission(10% Comm Of Sal) to
employees who are not earning any commission.
91. Delete those records where no of employees in a
particular department is less than 3.
92. Display those employee who has joined before 15th
of the month.

Dell - Internal Use - Confidential

93. Display employee name,deptname,salary and comm


for those sal in between 2000 to 5000 while location is
chicago.
94. Display name of those managers name whose salary
is more than average salary of his company?
95. Display the names of the employees from
department number 10 with salary greater than that of
all employee working in other departments
96. Display dname where at least 3 are working and
display only department name?
97. Display all employees names with total sal of
company with each employee name?
98. Display the employee name,job and his
manager.Display also employee who are without
manager?
99. Display the 10th record of emp table(without using
rowid)
100.Employee hire on 15th of any month are paid on the
last Friday of that month. Those hired after 15th are paid
the last Friday of the following month.Print a list of
employees.their hire date and first pay date scort those
whose salary contains first digits of their deptno?

Dell - Internal Use - Confidential

You might also like