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

Advanced SQL Questions and Answers

31.

The UNION clause is used to combine the output from multiple queries together into a single result table.

Answer: A

Correct answer: True

UNION takes the results of two or more queries and stacks them into one table, removing duplicate rows unless UNION ALL is used. The queries must be union compatible - the same number of columns, with corresponding types - since otherwise the rows could not be stacked at all.

Please log in or register to report this question.

32.

ROLLBACK WORK asks SQL to empty the log file.

Answer: A

Correct answer: True

ROLLBACK WORK undoes the transaction by applying the before-images from the log and then discards them, so the log entries for that transaction are emptied. The database returns to the state it held when the transaction began.

Please log in or register to report this question.

33.

The most frequently used relational operation, which brings together data from two or more related tables into one resultant table, is called an equi-join.

Answer: B

Correct answer: False

The most frequently used join is the natural join, which matches on the common column and returns it once rather than twice. The equi-join is the same operation with the duplicate column retained, and it is the natural join that is wanted in nearly every practical query.

Please log in or register to report this question.

34.

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.

35.

A correlated subquery is where the outer query depends on data from the inner query.

Answer: B

Correct answer: False

The dependence runs the other way. In a correlated subquery the inner query refers to a column of the outer, so it must be evaluated afresh for each row the outer query considers. That is what makes it correlated, and what makes it potentially expensive.

Please log in or register to report this question.

36.

A function returns one value and has only output parameters.

Answer: B

Correct answer: False

A function returns a single value and takes only input parameters, which is what allows it to be used within an expression like any built-in function. Output parameters belong to procedures, which is one of the two things distinguishing the two kinds of routine.

Please log in or register to report this question.

37.

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.

Loading…
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