Login Form




FAQ in SQL - 1 Print E-mail

1. Which is the subset of SQL commands used to manipulate Oracle Database structures, including tables?

Data Definition Language (DDL)

 

2. Which command displays the SQL command in the SQL buffer, and then executes it?

RUN

 

3. Which date function is used to find the difference between two dates?

MONTHS_BETWEEN

 

4. What is the use of CASCADE CONSTRAINTS?

When this clause is used with the DROP command, a parent table can be dropped even when a child table exists.

 

5. What will be the output of the following query?

SELECT REPLACE(TRANSLATE(LTRIM(RTRIM('!! ATHEN !!','!'), '!'), 'AN', '**'),'*','TROUBLE') FROM DUAL;

TROUBLETHETROUBLE

 

6. What command is used to get back the privileges offered by the GRANT command?

REVOKE

 

7. What operator tests column for the absence of data?

IS NULL operator

 

8. What is the advantage of specifying WITH GRANT OPTION in the GRANT command?

The privilege receiver can further grant the privileges he/she has obtained from the owner to any other user.

 

9. What is the output of the following query?

SELECT TRUNC(1234.5678,-2) FROM DUAL;

1200

 

10. What are the privileges that can be granted on a table by a user to others?

Insert, update, delete, select, references, index, execute, alter, all

 

11. What is the difference between TRUNCATE and DELETE commands?

TRUNCATE is a DDL command whereas DELETE is a DML command. Hence DELETE operation can be rolled back, but TRUNCATE operation cannot be rolled back. WHERE clause can be used with DELETE and not with TRUNCATE.

 

12. What does the following query do?

SELECT SAL + NVL(COMM,0) FROM EMP;

This displays the total salary of all employees. The null values in the commission column will be replaced by 0 and added to salary.

 

13. What is the parameter substitution symbol used with INSERT INTO command?

&

 

14. Why does the following command give a compilation error?

DROP TABLE &TABLE_NAME;

Variable names should start with an alphabet. Here the table name starts with an '&' symbol.

 

15. Which command executes the contents of a specified file?

START <filename> or @<filename>