SQL Assignment 1
SQL Assignment 1
SQL Assignment 1
EMPLOYEE_REF_ID
INCENTIVE_DATE
INCENTIVE_AMOUNT
1
01-FEB-13
5000
2
01-FEB-13
3000
3
01-FEB-13
4000
1
01-JAN-13
4500
2
01-JAN-13
3500
Questions:
3. Get First_Name from employee table using alias name “Employee Name”
9. Get FIRST_NAME from employee table after removing white spaces from right side
10. Get FIRST_NAME from employee table after removing white spaces from left side
12. Get First_Name from employee table after replacing 'o' with '$'
13. Get First_Name and Last_Name as single column from employee table separated by a '_'
14. Get FIRST_NAME ,Joining year, Joining Month and Joining Date from employee table
15. Get all employee details from the employee table order by First_Name Ascending
16. Get all employee details from the employee table order by First_Name Descending
17. Get all employee details from the employee table order by First_Name Ascending and Salary descending
18. Get employee details from employee table whose employee name is “Jhon”
19. Get employee details from employee table whose employee name are “Jhon” and “Roy”
20. Get employee details from employee table whose employee name are not “Jhon” and “Roy”
21. Get employee details from employee table whose first name starts with 'J'
22. Get employee details from employee table whose first name contains 'o'
23. Get employee details from employee table whose first name ends with 'n'
24. Get employee details from employee table whose first name ends with 'n' and name contains 4 letters
25. Get employee details from employee table whose first name starts with 'J' and name contains 4 letters
26. Get employee details from employee table whose Salary greater than 600000
27. Get employee details from employee table whose Salary less than 800000
28. Get employee details from employee table whose Salary between 500000 and 800000
29. Get employee details from employee table whose name is 'Jhon' and 'Michael'
30. Get employee details from employee table whose joining year is “2013”
31. Get employee details from employee table whose joining month is “January”
32. Get employee details from employee table who joined before January 1st 2013
33. Get employee details from employee table who joined after January 31st
34. Get employee details from employee table who joined between January 1st and January 31st
36. Get Joining Date, Time including milliseconds from employee table
37. Get difference between JOINING_DATE and INCENTIVE_DATE from employee and incentives table
39. Get names of employees from employee table who has '%' in Last_Name.
40. Get Last Name from employee table after replacing special character with white space
41. Get department, total salary with respect to a department from employee table.
42. Get department, total salary with respect to a department from employee table order by total salary descending
43. Get department, no of employees in a department, total salary with respect to a department from employee table
order by total salary descending
44. Get department wise average salary from employee table order by salary ascending
45. Get department wise maximum salary from employee table order by salary ascending
46. Get department wise minimum salary from employee table order by salary ascending
47. Select no of employees joined with respect to year and month from employee table
48. Select department, total salary with respect to a department from employee table where total salary greater than
800000 order by Total_Salary descending
49. Select First_Name, incentive amount from employee and incentives table for those employees who have
incentives
50. Select First_Name, incentive amount from employee and incentives table for those employees who have
incentives and incentive amount greater than 3000
51. Select First_Name, incentive amount from employee and incentives table for all employees even if they didn't get
incentives
52. Select First_Name, incentive amount from employee and incentives table for all employees even if they didn't get
incentives and set incentive amount as 0 for those employees who didn't get incentives.
53. Select First_Name, incentive amount from employee and incentives table for all employees who got incentives
using left join
54. Select max incentive with respect to employee from employee and incentives table using sub query
60. Select employee details from employee table if data exists in incentive table
61. Select 20 % of salary from Jhon , 10% of Salary for roy and for other 15 % of salary from employee table
62. Select Banking as 'Bank Dept', Insurance as 'Insurance Dept' and Services as 'Services Dept' from employee
table
63. Delete employee data from employee table who got incentives in incentive table
64. Insert into employee table Last Name with ''' (Single Quote - Special Character, Use single quote before special
character )
65. Select Last Name from employee table which contain only numbers
71. Write SQL Syntax to create EMPLOYEE_REF_ID in INCENTIVES table as foreign key with respect to
EMPLOYEE_ID in employee table
74. Write SQL syntax to create Oracle Trigger before insert of each row in employee table