Machine-translated by Google. Questions are authored in English.
Top

Advanced SQL Questions and Answers

Answer: C

Correct answer: They have an event, condition, and action.

The three parts define a trigger: the event that fires it, an optional condition restricting when it acts, and the action it performs. It is created with SQL, applies to every route into the database rather than to particular applications, and can perfectly well cause another trigger to fire.

Please log in or register to report this question.

Answer: C

Correct answer: Combines the output from multiple queries and must include the same number of columns.

UNION stacks the result sets, so the queries must agree in the number of columns and in the types of the corresponding ones - the union compatibility requirement. There is no limit of two: any number of SELECTs may be chained with UNION.

Please log in or register to report this question.

3.

The code to create triggers and routines is stored in only one location and is administered centrally.

Answer: A

Correct answer: True

Holding the code in the database means one copy serves every application that reaches the data, so a rule cannot be implemented differently in two places or omitted from one. That central administration is the principal argument for putting logic into triggers and routines rather than into each application.

Please log in or register to report this question.

Answer: A

Correct answer: Both consist of procedural code.

Both are blocks of procedural code stored in the database. What separates them is how they are invoked: a routine must be called explicitly, whereas a trigger fires by itself when its event occurs. Neither option describing invocation can therefore be true of both.

Please log in or register to report this question.

5.

When AUTOCOMMIT is set on, changes will be made automatically at the end of each SQL statement.

Answer: A

Correct answer: True

With AUTOCOMMIT on, each statement is its own transaction and is committed as soon as it completes. Multi-statement transactions therefore require it to be turned off, or an explicit transaction to be begun, so that the statements are committed together by COMMIT or undone together by ROLLBACK.

Please log in or register to report this question.

6.

Triggers are stored blocks of code that have to be called in order to operate.

Answer: B

Correct answer: False

A trigger fires by itself when its event occurs, which is the whole point of it: no application can bypass the rule by forgetting to call something. Stored blocks that must be called are procedures and functions, and the statement has attributed their behaviour to triggers.

Please log in or register to report this question.

7.

With the UNION clause, each query involved must output the same number of columns, and they must be UNION compatible.

Answer: A

Correct answer: True

The requirement has two parts and both are needed. The queries must produce the same number of columns, and the corresponding columns must be of compatible types - which together is what union compatibility means. Without it the rows could not be stacked into one result at all.

Please log in or register to report this question.

Answer: D

Correct answer: All of the above.

The catalogue is itself held as tables, so it can be queried with ordinary SELECT statements - which is how a developer discovers what columns a table has. It is maintained by the system in response to DDL, so it is not directly updatable; altering it by hand would leave the database inconsistent with itself.

Please log in or register to report this question.

9.

The joining technique is useful when data from several relations are to be retrieved and displayed and the relationships are not necessarily nested.

Answer: A

Correct answer: True

Joining is the natural technique when several relations must contribute columns to one result and the relationships between them are of equal standing. A subquery suits a genuinely nested question - find the customers whose orders exceed some computed figure - where one result feeds another.

Please log in or register to report this question.

10.

Outer join is the same as equi-join, except one of the duplicate columns is eliminated in the result table.

Answer: B

Correct answer: False

Eliminating the duplicate column is what distinguishes the natural join from the equi-join. An outer join does something else entirely: it keeps the rows that have no match on the other side, filling their missing columns with nulls. The statement has attached one join’s definition to another’s name.

Please log in or register to report this question.

Loading…

Other Subjects

Tags: Advanced SQL Questions and Answers || Advanced SQL MCQ Questions and Answers || Advanced SQL GK Questions and Answers || Advanced SQL GK MCQ Questions || Advanced SQL Multiple Choice Questions and Answers || Advanced SQL GK || GK on Advanced SQL || Database Questions and Answers || Database MCQ Questions and Answers || Database GK Questions and Answers || GK on Database