Oracle Database Practice Session


Oracle SQL Queries
S.No                                     Queries                                                      
01
Display the details of all employees
02
Display the depart information from department table
03
Display the name and job for all the employees
04
Display the name and salary  for all the employees
05
Display the employee no and total salary  for all the employees
06 Display the employee name and annual salary for all employees
07 Display the names of all the employees who are working in depart number 10.
08
Display the names of all the employees who are working as clerks and drawing a salary more than 3000.
09
Display the employee number and name  who are earning comm.
10
Display the employee number and name  who do not earn any comm.
11
Display the names of employees who are working as clerks, salesman or analyst and drawing a salary more than 3000.
12
Display the employee number and name  who are earning comm.
13
Display the employee number and name  who do not earn any comm.
14
Display the names of employees who are working as clerks, salesman or analyst and drawing a salary more than 3000.
15
Display the names of the employees who are working in the company for the past 5 years
16
Display the list of employees who have joined the company before 30-JUN-90 after 31-DEC-90.
17
Display current Date.
18
Display the list of all users in your database(use catalog table).
19 Display the names of all tables from current user
20
Display the name of the current user.
21
Display the names of employees working in depart number 10 or 20 or 40 or employees working as CLERKS, SALESMAN or ANALYST.
22
Display the names of employees whose name starts with alphabet S.
23
Display the Employee names for employees whose name ends with alphabet S.
24
Display the names of employees whose names have second alphabet A in their names.
25
Select the names of the employee whose names is exactly five characters in length. 
26
Display the names of the employee who ar e not working as MANAGERS.
27
Display the names of the employee who are not work ing as SALESMAN OR CLERK OR ANALYST.
28
Display all rows from EMP table. The system should wait after every Screen full of information. 
29
Display the total number of employee working in the company.
30
Display the total salary beiging paid to all employees.
31
Display the maximum salary from emp table. 
32
Display the minimum salary from emp table. 
33
Display the average salary from emp table. 
34
Display the maximum salary being paid to CLERK. 
35
Display the maximum salary being paid to depart number 20.
36
Display the minimum salary being paid to any SALESMAN.
37
Display the average salary drawn by MANAGERS.
38
Display the total salary drawn by ANALYST working in depart number 40.
39
Display the names of the employee in order of salary i.e the name of the employee earning lowest salary should salary appear first. 
40
Display the names of the employee in descending order of salary.
41
Display the names of the employee in order of employee name.
42
Display empno, ename, deptno, sal sort the output first base on name and within name by deptno and with in deptno by sal.
43
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. 
44
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. 
45
Display depart numbers and total number of employees working in each department.
46
Display the various jobs and total number of employees within each job group. 
47
Display the depart numbers and total salary for each department. 
48
Display the depart numbers and max salary for each department. 
49 Display the depart numbers with more than three employees in each dept. 
50 Display the various jobs and total salary for each job.
51
Display the various jobs along with total salary for each of the jobs where total salary is greater than 40000.
52
Display the various jobs along with total number of employees in each job. The output should contain only those  jobs with more than three employees.
53
Display the name of the empployee who earns highest salary.
54
Display the employee number and name for employee working as clerk and earning highest salary among clerks.
55
Display the names of salesman who earns a salary more than the highest salary of any clerk. 
56 Display the names of clerks who earn a salary more than the lowest salary of any salesman.
57
Display the names of employees who earn a salary more than that of Jones or that of salary grether than   that of scott. 
58
Display the names of the employees who earn highest salary in their respective departments. 
59
Display the names of the employees who earn highest salaries in their respective job groups.
60
Display the employee names who are working in accounting department. 
61 Display the employee names who are working in Chicago. 
62
Display the Job groups having total salary greater than the maximum salary for managers. 
63
Display the names of employees from department number 10 with salary greater than that of any employee working in other department.
64
Display the names of the employees from department number 10 with salary greater than that of all employee working in other departments.
65
Display the names of the employees in Uppercase. 
66
Display the names of the employees in Lowecase.
67
Display the names of the employees in Propercase. 
68
Display the length of Your name using appropriate function. 
69
Display the length of all the employee names.
70
Select name of the employee concatenate with employee number.
71
User appropriate function and extract 3 characters starting from 2 characters from the following  string 'Oracle'. i.e the out put should be 'ac'.
72
Find the First occurance of character 'a' from the following string i.e 'Computer Maintenance Corporation'.
73
Replace every occurance of alphabhet A with B in the string Allens(use translate function)
74
Display the informaction from emp table.Where job manager is found it should be displayed as boos(Use replace function).
75
Display your age in days. 
76
Display your age in months.
77
Display the current date as 15th Augest Friday Nineteen Ninety Saven.
78
Display the following output for each row from emp table. scott has joined the company on wednesday 13th August ninten nintey.
79
Find the date for nearest saturday after current date.
80
Display current time. 
81
Display the date three months Before the current date. 
82 Display the common jobs from department number 10 and 20. 
83
Display the jobs found in department 10 and 20 Eliminate duplicate jobs. 
84
Display the jobs which are unique to department 10. 
85
Display the details of those who do not have any person working under them.
86
Display the details of those employees who are in sales department and grade is 3.
87
Display those who are not managers and who are managers any one.
i ) display the managers names
ii) display the who are not managers
88
Display those employee whose name contains not less than 4 characters.
89
Display those department whose name start with "S" while the location name ends with "K".
90
Display those employees whose manager name is JONES.
91
Display those employees whose salary is more than 3000 after giving 20% increment.
92
Display all employees while their dept names; 
93
Display ename who are working in sales dept. 
94
Display employee name,deptname,salary and comm for those sal in between 2000 to 5000 while location is chicago. 
95
Display those employees whose salary greater than his manager salary. 
96
Display those employees who are working in the same dept where his manager is work.
97
Display those employees who are not working under any manager. 
98
Display grade and employees name for the dept no 10 or 30 but grade is not 4 while joined the company before 31-dec-82. Update the salary of each employee by 10% increments that are not Eligible for commission.
99
SELECT that employee who joined the company before 31-dec-82 while
Their dept location is new York or Chicago.
100
DISPLAY EMPLOYEE NAME, JOB, DEPARTMENT, LOCATION FOR ALL WHO ARE WORKING
AS MANAGER?

0 comments: