Professional Documents
Culture Documents
(2) Create one table from another table without copying the data from the first table.
(3) How do I select from different users tables?
(4) What is SQL?
(5) What is a function in oracle?
(6) What is the default format of date in Oracle? How can I change my default date format?
a)
b)
c)
d)
e)
f)
g)
h)
i)
j)
k)
l)
m)
n)
o)
p)
Deptno
Empno
Sal
10
1000
10
3000
20
2000
30
6000
20
1000
60
9000
10
1000
Table2
Deptno
10
40
(34) Write the syntax to add Foreign Key?
(35) Write the syntax to create Composite Primary Key?
(36) How to run the SQL statements from a file?
(37) What is a schema?
(38) What are DCLs?
(39) What are roles & privileges?
(40) What are sub query statements and co-related sub query statements?
Syntax:
15. Display job wise total salary excluding dept 30 only if the total salary is > 5000
16. Display job wise max sal only for managers, clerks, salesman working in dept 10 and 20. Sort
the data by des order of the max salary.
17. Display job wise number of employees in all the department with total salary > 9000
18. Display the department number having atleast 4 employees in it
19. Display the department having only saleman in it
20 Calculate number of L in string 'HELLLLL'
21. Display all the employees whose job has a string 'MAN'
22. Display all the employees whose job starts with string 'MAN'
23. Display all the employees whose job ends with string 'MAN'
25. Display first 3 characters of ename in lower case and rest everything in upper case.
If ename is 'MITHUNASHOK' then display this as 'mitHUNASHOK'
Here SMITH is ename column, CLERK is JOB and 2000 is SAL column and rest everything is literal
strings.
Co-Related Subqueries:
16. Write a query to get 4th max salary from EMP table
17. Write a query to get 2nd & 6th max salary from EMP table
18. Write a query to get first 3 salaries from the EMP table
19. Write a query to get 2nd least salary from the EMP table
20. Write a query to get least 3 salaries from the EMP table
21. List all the employees whose salaries are greater than their respective departmental average
salary.