Database HW 4
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
B) WHERE
Correlation names are temporary table names assigned in which clause? A) FROM B) WHERE C) ORDER BY D) ON
A) FROM
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
A) includes only rows that occur in both result sets
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
A) inner join
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
A) left outer
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
A) the number of rows in the Invoices table
___________________ names can be used when you want to assign a temporary name to a table. A) Table B) Correlation C) Qualified D) Object
B) Correlation
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
B) a self-join
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
B) code only join conditions in the ON clause
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
B) foreign
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
B) rows in both tables that don't satisfy the join condition
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
B) you have to use that name for the table in the query
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
C) lets you combine the join and seearch conditions
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.
D) The result sets must be derived from different tables.
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
D) WHERE
A union combines the rows from two or more what? A) SELECT statements B) result tables C) queries D) all of the above
D) all of the above
(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
D) both b and c
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
D) none of the above
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
D) rows in the second table
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
D) when the same names are used in both tables