Set - 3

Question 16 :

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

Answer :

Data Definition Language (DDL).


Question 17 :

What is the use of DESC in SQL?

Answer :

DESC has two purposes. It is used to describe a schema as well as to retrieve rows from table in descending order.
Explanation :
The query SELECT * FROM EMP ORDER BY ENAME DESC will display the output sorted on ENAME in descending order.


Question 18 :

What command is used to create a table by copying the structure of another table?

Answer :

CREATE TABLE .. AS SELECT command
Explanation:
To copy only the structure, the WHERE clause of the SELECT command should contain a FALSE statement as in the following.
CREATE TABLE NEWTABLE AS SELECT * FROM EXISTINGTABLE WHERE 1=2;
If the WHERE condition is true, then all the rows or rows satisfying the condition will be copied to the new table.


Question 19 :

TRUNCATE TABLE EMP; DELETE FROM EMP; Will the outputs of the above two commands differ?

Answer :

Both will result in deleting all the rows in the table EMP..


Question 20 :

What is the output of the following query SELECT TRUNC(1234.5678,-2) FROM DUAL;?

Answer :

1200.