You are on page 1of 4

FAQ’s

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

SELECT TABLE_NAME FROM USER_TABLES;

(2) How do I list all the indexes created for a particular table (say EMP)?

SELECT INDEX_NAME FROM USER_INDEXES

WHERE TABLE_NAME='EMP';

(3) How do I list all constraints created for a particular table (say EMP)?

SELECT CONSTRAINT_NAME FROM USER_CONSTRAINTS

WHERE TABLE_NAME='EMP';

(4) Create one table from another table without copying the data from the first table.

CREATE TABLE new_table


AS (SELECT * FROM old_table WHERE 1=2);

(5) How do I select from different user’s tables?

SELECT * FROM all_tables;

(6) What is the default format of date in Oracle? How can I change my default date
format?

SELECT value FROM v$nls_parameters WHERE parameter


='NLS_DATE_FORMAT';

DD-MON-RR

(7) Difference between


a) ROLLBACK & SAVEPOINT
b) ROLLBACK & COMMIT
c) Truncate & Delete
d) Truncate & Drop
e) Delete & Drop
f) PK and (UNIQUE + Not Null)
g) ROUND & TRUNC
h) ROWID & ROWNUM
i) Alternate Key & Candidate Key
j) Simple Key & Composite Key
k) Stored Procedure and Function
l) Stored Procedure and Trigger
m) Equi-Join and Outer Join
n) CHAR & VARCHAR2
o) CASE Statements & DECODE
p) 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 a Package? What are its uses?

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.

(22) What are exceptions?

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

UPDATE EMP
SET SAL=SAL+SAL*0.1
WHERE DEPTNO IN(SELECT DEPTNO FROM DEPT)

Table1

Deptno Empno Sal


10 1 1000
10 2 3000
20 3 2000
30 4 6000
20 5 1000
60 6 9000
10 7 1000

Table2

Deptno
10
40

ALTER TABLE DEPT


ADD CONSTRAINT DEPT_DEPTNO_PK PRIMARY KEY(DEPTNO);

(34) Write the syntax to add Foreign Key?


ALTER TABLE EMP
ADD CONSTRAINT EMP_DEPTNO_FK FOREIGN KEY(DEPTNO)
REFERENCING DEPT(DEPTNO)

(35) Write the syntax to create Composite Primary Key?


ALTER TABLE DEPT
ADD CONSTRAINT DEPT_DEPTNO_PK 1PRIMARY KEY(DEPTNO,DNAME);

(36) How to run the SQL statements from a file?

(37) What is a schema?

(38) What are DCLs?

(39) What are roles & privileges?

1. How does one get the time difference between two date columns?

2. How does one generate primary key values for a table?


3. How does one add a day/hour/minute/second to a date value?

4. How does one count different data values in a column?

5. How does one count/sum RANGES of data values in a column?

6. Can one retrieve only the Nth row from a table?

7. Can one retrieve only rows X to Y from a table?

8. How does one select EVERY Nth row from a table?

9. How does one select the TOP N rows from a table?

10. Can one drop a column from a table?

11. Can one rename a column in a table?

12. How can I change my Oracle password?

Refer http://orafaq.com/faqsql.htm for answers

• To know brief knowledge of Oracle Terms visit http://orafaq.com/ and


navigate to Glossary.

You might also like