SQL INTERVIEW QUESTION & ANSWERS
111. |
What column names must be specified in an EXISTS predicate? |
|
It does not matter what columns or how many columns you specify in the SELECT clause of the subquery in an EXISTS predicate. This type of predicate is concerned only with whether rows are being
returned, not with the content of those rows. You can specify any column names or just an asterisk. |
112. |
What two restrictions apply to PRIMARY KEY constraints but not to UNIQUE constraints? |
|
A column that is defined with a PRIMARY KEY constraint cannot contain null values, and only one PRIMARY KEY constraint can be defined for each table. |
113. |
What is a Stored Procedure? |
|
- A stored procedure is a set of pre–compiled SQL commands (query statements), which are stored in the server.
- It is faster then the loose SQL statements processed on client, as it is pre–compiled.
- It can execute more then one SQL commands once as they are bundled in a single entity.
- We can use control statements within the stored procedure, which will allow us to repeat some SQL command.
- It can send return values depending upon the result.
- Stored procedures are used to reduce network traffic.
|
114. |
What is the logical negation of the IN operator? |
|
NOT IN |
115. |
Which SQL statement should you use to delete a table definition and all its SQL data from a database? |
|
DROP TABLE |