6.
What is true about the result of a query without an ORDER BY clause?
- A.It is relational as long as other relational requirements are met.
- B.It cannot have duplicates.
- C.The order of the rows in the output is guaranteed to be the same as the insertion order.
- D.The order of the rows in the output is guaranteed to be the same as that of the clustered index.
- Answer & Explanation
- Report
Answer : [A]
Explanation :
Explanation :
A. Correct: A query with an ORDER BY clause doesn’t return a relational result. For
the result to be relational, the query must satisfy a number of requirements, including
the following : the query must not have an ORDER BY clause, all attributes
must have names, all attribute names must be unique, and duplicates must not
appear in the result. B. Incorrect: A query without a DISTINCT clause in the SELECT clause can return duplicates. C. Incorrect: A query without an ORDER BY clause does not guarantee the order of rows in the output. D. Incorrect: A query without an ORDER BY clause does not guarantee the order of rows in the output. |
7.
What is the importance of the ability to assign attribute aliases in T-SQL? (Choose all
that apply.)
- A.The ability to assign attribute aliases is just an aesthetic feature.
- B.An expression that is based on a computation results in no attribute name unless you assign one with an alias, and this is not relational.
- C.T-SQL requires all result attributes of a query to have names.
- D.Using attribute aliases, you can assign your own name to a result attribute if you need it to be different than the source attribute name.
- Answer & Explanation
- Report
Answer : [B, D]
Explanation :
Explanation :
A. Incorrect: Attribute aliasing allows you to meet relational requirements, so it’s
certainly more than an aesthetic feature. B. Correct: The relational model requires that all attributes have names. C. Incorrect: T-SQL allows a result attribute to be without a name when the expression is based on a computation without an alias. D. Correct: You can assign your own name to a result attribute by using an alias. |
8.
What are the mandatory clauses in a SELECT query, according to T-SQL?
- A.The FROM and SELECT clauses
- B.The SELECT and WHERE clauses
- C.The SELECT clause
- D.The FROM and WHERE clauses
- Answer & Explanation
- Report
Answer : [C]
Explanation :
Explanation :
A. Incorrect: The FROM and SELECT clauses are mandatory in a SELECT query according
to standard SQL but not T-SQL. B. Incorrect: The WHERE clause is optional in T-SQL. C. Correct: According to T-SQL, the only mandatory clause is the SELECT clause. D. Incorrect: The FROM and WHERE clauses are both optional in T-SQL. |
9.
Which of the following practices are considered bad practices? (Choose all that apply.)
- A.Aliasing columns by using the AS clause
- B.Aliasing tables by using the AS clause
- C.Not assigning column aliases when the column is a result of a computation
- D.Using * in the SELECT list
- Answer & Explanation
- Report
Answer : [C, D]
Explanation :
Explanation :
A. Incorrect: Aliasing columns with the AS clause is standard and considered a best
practice. B. Incorrect: Aliasing tables with the AS clause is standard and considered a best practice. C. Correct: Not aliasing a column that is a result of a computation is nonrelational and is considered a bad practice. D. Correct: Using * in the SELECT list is considered a bad practice. |
10.
Why is it important to use the appropriate type for attributes?
- A.Because the type of your attribute enables you to control the formatting of the values
- B.Because the type constrains the values to a certain domain of supported values
- C.Because the type prevents duplicates
- D.Because the type prevents NULLs
- Answer & Explanation
- Report
Answer : [B]
Explanation :
Explanation :
A. Incorrect: Formatting isn’t a responsibility of the type or the data layer in general;
rather, it is the responsibility of the presentation layer. B. Correct: The type should be considered a constraint because it limits the values allowed. C. Incorrect: The type itself doesn’t prevent duplicates. If you need to prevent duplicates, you use a primary key or unique constraint. D. Incorrect: A type doesn’t prevent NULLs. For this, you use a NOT NULL constraint |