You are on page 1of 7

(1) How do I list all of my tables?

(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)

(7) Difference between


ROLLBACK & SAVEPOINT
ROLLBACK & COMMIT
Truncate & Delete
Truncate & Drop
Delete & Drop
PK and (UNIQUE + Not Null)
ROUND & TRUNC
ROWID & ROWNUM
Alternate Key & Candidate Key
Simple Key & Composite Key
Stored Procedure and Function
Stored Procedure and Trigger
Equi-Join and Outer Join
CHAR & VARCHAR2
CASE Statements & DECODE
UNION and UNION ALL
8) What is a view? What are its advantages?
9) What is a synonym?
10) What is PL/SQL?
11) What is an Index? Why it is useful?
12) What is PL/SQL?
13) Mention some features of Oracle 9i database.
14) Mention some features of Oracle 10g database.

15) What is the meaning of i and g in 9i & 10g respectively?


16) What is the purpose of joining the tables? Explain different types of Joins.
17) What are the data types available in Oracle? Explain.
(18) What is Database Link?
(19) What is Tuning? Explain.
(20) What is DDL? Give examples.
(21) What is DML? Give examples.
(23) What is the difference between DBMS & RDBMS?
(24) State some of the Codd Rules.
(25) What is normalization? Explain.
(26) Few differences between Oracle and SQL Server databases.
(27) What is a Sequence?
(28) Write a query to eliminate duplicates rows from a table?
(29) How does one implement IF-THEN-ELSE in a select statement?
(30) How we can send the query output to a file?
(31) Display the Department Names that are having more than 4 employees in it?
(31) What is SQL* Loader?
(32) What is Export & Import?
(33) Increase the salaries of all the employees by 10% for the departments that are
common in both of these tables.
Table1

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?

Questions on BASIC SELECT Statement


BASIC SELECT Statement:

Syntax:

SELECT *|{[DISTINCT] column|expression [alias],...}


FROM table;

1. Display all rows and all columns of emp table


2. Display any 2 columns of emp table
3. Calculate annual salary with Quarterly commission of 500
4. Display distinct salaries of all the employees
5. Display output as following,
"Hello SMITH your salary is 5000"
6. Is the following statement correct,
SeleCT ENAME,deptno FROM emp;
select *,ename from emp;
select ename deptno from emp;
Questions on Basic SELECT statement:
Syntax:
SELECT *|{[DISTINCT] column|expression [alias],...}
FROM table
[WHERE condition(s)];

Questions on BASIC SELECT with Conditions


1. Display all the employees whose name starts with 'S'
2. List the employees name having letter 'L' as the second character
3. List the employees name having 'E' as last but one character
4. List the employees name having exactly 4 letters
5. List the employee whose name is having letter 'L'
6. List the employees name having atleast 5 characters
7. List employees earning between 2000 and 3000
9. List emp who do not have any reporting manager or commision is Null
10. List emp who do not have any reporting manager AND commision is Null

11. List only managers


12. List managers working in dept 10 and 20
13. List all the clerks and analysts with salary atleast 1000 in dept 20 and 30
14. List the employees in dept 20 and 30 who get no commision
15. List employees whose name starts with either 'A' or 'S' in dept 20
16. List all the employee whoe name does not end with 'S' in dept 20 and 30
17. List the employees who are getting some commision with sal > 1500 in dept 30
18. List the employees who are getting some commision with sal>1500 in dept 30
19. List emp working as managers and clerks with Salary atleast 2000 except in dept 10 and 20
20. List emp who get commmision
21. List employees in all dept whose salary not in the range of 2000 to 3000 with the job which is
having a string called 'MAN'

SQL Interview Questions on Functions


SQL Functions:

Use only functions for data manupulation.

1. List employees whose name having 4 characters


2. List employees whose job is having 7 characters
3. Find out howmany times letter 'S' occurs in 'qspiders'
4. List the employees whose job is having last 3 characters as 'man'
5. List employees whose job is having first 3 characters as 'man'
6. Display all the names whose name is having exactly 1 'L'
7. Display dept names which are having letter 'O'
8. Display the output as shown below,
Scott working as a clerk earns 3000 in dept 20
9. Display employees who earn odd numbered salaries
10. Display number of employees getting NULL comission.
11. Display total sal and comm drawn by dept 30
12. Count number of clerks in dept 10 and 20
13. List Department wise total salary
14. List department wise total sal only if the total sal is > 3000

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'

26. Display the result from emp table as below.

SMITH is a CLERK and gets salary 2000

Here SMITH is ename column, CLERK is JOB and 2000 is SAL column and rest everything is literal
strings.

SQL Interview Questions on Subqueries


SUB Queries:

1. List the employees working in research department

2. List employees who are located in New York and Chicago


3. Display the department name in which ANALYSTS are working
4. Display employees who are reporting to JONES
5. Display all the employees who are reporting to Jones Manager
6. Display all the managers in SALES and ACCOUNTING department
7. Display all the employee names in Research and Sales Department who are having at least 1
person reporting to them
8. Display all employees who do not have any reportees
9. List employees who are having at least 2 reporting
10. List the department names which are having more than 5 employees
11. List department name having at-least 3 salesman
12. List employees from research and accounting having at-least 2 reporting
13. Display second max salary
14. Display 4th max salary
15. Display 5th max salary -- Answer for nth Max Salary

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.