|
|
|
SQL Interview Questions with Answers - Set 4
1. Which function is used to find the largest integer less than or equal to a specific value? FLOOR.
2. Which is the subset of SQL commands used to manipulate Oracle Database structures, including tables? Data Definition Language (DDL).
3. 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.
4. What command is used to create a table by copying the structure of another table? 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.
5. 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..
6. What is the output of the following query SELECT TRUNC(1234.5678,-2) FROM DUAL;? 1200.
7. What are the wildcards used for pattern matching.? _ for single character substitution and % for multi-character substitution.
8. What is the parameter substitution symbol used with INSERT INTO command? &
9. What's an SQL injection? SQL Injection is when form data contains an SQL escape sequence and injects a new SQL query to be run.
10. What is difference between TRUNCATE & DELETE TRUNCATE commits after deleting entire table i.e., cannot be rolled back. Database triggers do not fire on TRUNCATE DELETE allows the filtered deletion. Deleted records can be rolled back or committed. Database triggers fire on DELETE.
|
No responses found. Be the first to respond and make money from revenue sharing program.
|