Login Form




FAQ in SQL - 2 Print E-mail

1. What operator performs pattern matching?

LIKE operator

 

2. Which function is used to find the largest integer less than or equal to a specific value?

FLOOR

 

3. What is the use of the DROP option in the ALTER TABLE command?

It is used to drop constraints specified on the table.

 

4. TRUNCATE TABLE EMP;
DELETE FROM EMP;

Will the outputs of the above two commands differ?

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

 

5. State true or false. EXISTS, SOME, ANY are operators in SQL.

True

 

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

SELECT DECODE(TRANSLATE('A','1234567890','1111111111'), '1','YES', 'NO' );

Answer :   NO

Explanation :  The query checks whether a given string is a numerical digit.

 

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

 

8. What are the wildcards used for pattern matching?

_ for single character substitution and % for multi-character substitution

 

9. What is the value of ‘comm’ and ‘sal’ after executing the following query if the initial value of ‘sal’ is 10000?

UPDATE EMP SET SAL = SAL + 1000, COMM = SAL*0.1;

sal = 11000, comm = 1000

 

10. Which system tables contain information on privileges granted and privileges obtained?

USER_TAB_PRIVS_MADE, USER_TAB_PRIVS_RECD

 

11. State true or false. !=, <>, ^= all denote the same operation.

True

 

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

 

13. Which system table contains information on constraints on all the tables created?

USER_CONSTRAINTS