Wednesday, May 30, 2007

SQL FAQS 04

SQL Interview Questions And Answers [Siebel Frequently Asked Questions ,Siebel FAQ ]

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

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

What will be the output of the following query?
SELECT REPLACE(TRANSLATE(LTRIM(RTRIM('!! ATHEN !!','!'), '!'), 'AN', '**'),'*','TROUBLE') FROM DUAL;?
TROUBLETHETROUBLE. p>

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.

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.

Which command executes the contents of a specified file?
START or @.

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.

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

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

What will be the output of the following query?
SELECT DECODE(TRANSLATE('A','1234567890','1111111111'), '1','YES', 'NO' );?
NO.

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

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

What operator performs pattern matching?
LIKE operator.

What is the use of the DROP option in the ALTER TABLE command?
It is used to drop constraints specified on the table.

What operator tests column for the absence of data?
IS NULL operator.

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.

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

Which is the subset of SQL commands used to manipulate Oracle Database structures, including tables?
Data Definition Language (DDL).

What is the use of DESC in SQL?
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.

No comments: