Database HW 4

24 July 2022
4.7 (114 reviews)
20 test answers

Unlock all answers in this set

Unlock answers (16)
question
In a join, column names only need to be qualified where? A) in inner joins B) in outer joins C) when the code is confusing D) when the same names are used in both tables
answer
D) when the same names are used in both tables
question
If you assign a correlation name to one table in a join, A) you have to assign them to all of the tables in the query B) you have to use that name for the table in the query C) you have to qualify every column name in the query D) you have to qualify all of the column names for that table
answer
B) you have to use that name for the table in the query
question
When you need to code multiple conditions in a join, it's best to A) code all conditions in the ON clause B) code only join conditions in the ON clause C) code all conditions in the WHERE clause D) code only join conditions in the WHERE clause
answer
B) code only join conditions in the ON clause
question
Which of the following is not a reason for using the explicit syntax instead of the implicit syntax for inner joins? The explicit syntax A) is easier to read and understand B) lets you separate the join and search conditions C) lets you combine the join and seearch conditions D) lets you combine inner and outer joins
answer
C) lets you combine the join and seearch conditions
question
In a cross join, all of the rows in the first table are joined with all of the A) distinct rows in the second table B) matched rows in the second table C) unmatched rows in the second table D) rows in the second table
answer
D) rows in the second table
question
When you code a union that combines two result sets, which of the following is not true? A) Each result set must have the same number of columns. B) The result sets may or may not have any duplicate rows. C) The corresponding columns in the result sets must have compatible data types. D) The result sets must be derived from different tables.
answer
D) The result sets must be derived from different tables.
question
When you code a union with the INTERSECT keyword to combine two result sets, the union A) includes only rows that occur in both result sets B) excludes rows from the first result set if they also occur in the second result set C) includes all rows that occur in both result sets if the primary keys are the same D) excludes rows from the second result set if they also occur in the first result set
answer
A) includes only rows that occur in both result sets
question
A full outer join includes rows that satisfy the join condition, plus A) rows in the left table that don't satisfy the join condition B) rows in both tables that don't satisfy the join condition C) rows in the right table that don't satisfy the join condition D) the Cartesian product of the two tables
answer
B) rows in both tables that don't satisfy the join condition
question
SELECT VendorName AS Vendor, InvoiceDate AS Date FROM Vendors AS v JOIN Invoices AS i ON v.VendorID = i.VendorID; (Refer to code example 4-1.) This type of join is called a/an A) inner join B) outer join C) left join D) right join
answer
A) inner join
question
(Refer to code example 4-1.) The name "v" is known as a? A) placeholder B) correlation name C) table alias D) both b and c
answer
D) both b and c
question
SELECT VendorName, InvoiceNumber FROM Invoices LEFT JOIN Vendors ON Invoices.VendorID = Vendors.VendorID; (Refer to code example 4-2.) The total number of rows returned by this query must equal A) the number of rows in the Invoices table B) the number of rows in the Vendors table C) the number of rows in the Invoices table plus the number of rows in the Vendors table D) none of the above
answer
A) the number of rows in the Invoices table
question
SELECT VendorName, InvoiceNumber FROM Invoices LEFT JOIN Vendors ON Invoices.VendorID = Vendors.VendorID; (Refer to code example 4-2.) If the LEFT keyword is replaced with the FULL keyword, the total number of rows that are returned must equal A) the number of rows in the Invoices table B) the number of rows in the Vendors table C) the number of rows in the Invoices table plus the number of rows in the Vendors table D) none of the above
answer
D) none of the above
question
In most cases, the join condition of an inner join compares the primary key of one table to the ____________________ key of another table. A) primary B) foreign C) unique D) SELECT
answer
B) foreign
question
___________________ names can be used when you want to assign a temporary name to a table. A) Table B) Correlation C) Qualified D) Object
answer
B) Correlation
question
If you want to join all of the rows in the first table of a SELECT statement with just the matched rows in a second table, you use what kind of join? A) left outer B) right outer C) full outer D) cross
answer
A) left outer
question
When you use the implicit syntax for coding inner joins, the join conditions are coded in which clause? A) SELECT B) FROM C) ORDER BY D) WHERE
answer
D) WHERE
question
A union combines the rows from two or more what? A) SELECT statements B) result tables C) queries D) all of the above
answer
D) all of the above
question
Correlation names are temporary table names assigned in which clause? A) FROM B) WHERE C) ORDER BY D) ON
answer
A) FROM
question
Your code will be easier to read if you code the join condition in the ON expression, and the search conditions in the which clause? A) FROM B) WHERE C) ORDER BY D) any of the above
answer
B) WHERE
question
A join that joins a table with itself is called A) a U-join B) a self-join C) an outer join D) an inner join
answer
B) a self-join