snr-sql tasks

Embed Size (px)

Citation preview

  • 7/28/2019 snr-sql tasks

    1/3

    SQL

    S.N.Reddy [email protected] Page 1

    1. Extract all the employee details2. Extract employee number, name, salary, commission.3. Extract employee details whose name is Scott4. create a table with the table name as sun sys and with column names eno,ename with

    the size 9 ,job,sal,deptno5. Add a column date of joining to sunsys table (table existed).6. 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 oracle images .will it insert successfully? Otherwise how you can insert that ename sunsys table.

    7. Insert the below data into sunsys table.Empno ename job Sal deptno1001 king manager 5000 101002 jeorge 2300 301003 althaf salesman 1570

    1004 cashier 2750 408. Try to insert the above data into sun ray table at run time. 9. Update a column ename with watson and update job as Buyer, where the empno is1004.10. Delete all the details of the employee, whose enpno is 1006 and 1007.11. Extract all the employee details in salary wise descending order.12. Extract all the EMP details in empno wise ascending and job wise descending order.13. Extract ename, job of the sunsys table in lower case.14. Extract ename,job of the sunsys table in upper case15. Extract ename,job of the sunsys table in initcap case16. Extract enames with first half letters in lower case and second half in initcap. 17. 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 todept 20

    18. Find out the length of all the employee names.19. Extract all the EMP details with the length of those names.20. Find out the position of string a for all enames in sunsys table. 21. Fetch a string ima from the string oracle images 22. Write a query to display the number 5467.988, by using number 5467.987453.23. Write a query to display the number 5467.987, by using the number 5467.987453.24. Count the employees, howmany are working in the organization sun sys. 25. Find out the days, between yo ur birth dates to todays date. 26. Write a query to display the date as 01-may-2011, by using the date 01-aug-2011.

    27. Write a query to display the date as 01-may-2011, by using the date 01-jan-2011.28. Find out the highest salary of sun sys organization.29. Extract t he employee details, whose empnos are 1002 and 1006 and 1007. 30. Extract the EMP details, except the details of empnos 1002 and 1007. 31. Find out the average salaries for department wise.32. Find out the total salaries of sun sys organization.33. Extract the emp details whose salary is between 4356 and 2310.34. Extract the emp details whose salary is not between 4356 and 2310.

  • 7/28/2019 snr-sql tasks

    2/3

    SQL

    S.N.Reddy [email protected] Page 2

    35. Extract the emp details who doesnt have manager. 36. Extract empno, ename, sal, daywiae salary, annual salary, total income of the month and

    year.37. How many weeks are there between the dates 12 -may- 1986 to 12 -May- 2011. 38. Extract the emp details whose names fourth character starts withs and ends with a. 39. Find out how many as are in your name. 40. Find out how many as are there in all emp names. 41. Extract the emp details, whose name contain minimum 2 as. 42. Extract the emp details whose empno contain only numbers.43. Extract the emp details whose empno contain only characters.44. Extract the emp details whose empno contain numbers and characters.45. Extract empno, ename, deptno, dept name of all employees.46. Extract empno, ename, deptno, dept name, salary grade of all employees.47. Extract all the rows of the emp, dept, sal grade tables. (Dont miss any row). 48. Extract employee name and his manager name.49. Extract all the emp details whose employee salary is greater than his manager salary.50. Extract ename, manager name, Sal grade and his deptno of all employees.51. Write a query to find out dept wise maximum salary.52. Write a query to find out, what are the jobs avialable in the sunsys organization.53. Extract ename, dept name, dept wise minimum salary of all employees.54. Write a query to find out duplicate rows in a table;55. Write a query to delete duplicate row from a table;56. Write a query to extract all the departrment details, which department having atleast

    2employees.57. Extract the employee detail, who is not working under the department sales. 58. Extract the emp details, who is working under the departments sales and research. 59. 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.

    60. Extract emp details ename,dname ,whose emp name contain atleast one aAnd his salary between 2189 and 4325 or he belongs to the deptno 20 or 10And he is not belongs to the dept operations.

    61. Extract the emp detail who is not working under the manager king (ref: emp table). 62. Calculate and display the experience of all employees.63. Extract the emp details, who are senior in your organization.64. Extract the emp details, who have joined after second half of the 1985 year.

    65. Extract the emp details, who are having atleast 3years of experience.66. Extract the emp details, who have joined after second half of the 1979 year or who arehaving atleast 16 years of experience and his department name must contain atlest 5characters.

    67. Extract all the emp details who are joined before the second half of the 1986 year and themonth of his joining date should be may or month of his joiniung should not be Ap ril,June, July.

    68. Extract all the emp details, who is senior than his manager.

  • 7/28/2019 snr-sql tasks

    3/3

    SQL

    S.N.Reddy [email protected] Page 3

    69. Extract the emp details who is joined on the day 15 th or not joined on the month of June,July, August and he will be junior to his manager and his salary shoild be greater thanhis managers salary.

    70. Write a query to display all the jobs in your organization, but atlest three employees needwork under that job.

    71. I have data like this./Empnumber is... .., 7561 and hisss naaame issa snr annd... his ---salary isssssRs:4532. Write a query to display the above data as like thisEmpnumber is 7561 and his name is snr and his salary is Rs: 4532.

    72. Extract the emp details as ename, dept name, location, whose ename not starts withsand employee name should contain 5 characters.and his grade should be 2 or 3 and he isnot belongs to the location dallas and his joining date of the month sholud not be aprilor 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.73. Extract the employee details who are having maximum day-salary.74. Extract the emp details with week-salary.75. 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 mus t working under his manager and his grade will be 2 or 3 and his department name should not contain thecharacter h and l and he must joined in the organization before the second half of theyear 1987 or he would not joined on the month of jun, july of the year 1985.