Which two statements are true regarding the USING and ON clauses in table joins?

Which two statements are true regarding the USING and ON clauses in table joins? (Choose two.)

Which two statements are true regarding the USING and ON clauses in table joins? (Choose two.)

A.
The ON clause can be used to join tables on columns that have different names but compatible
data types

B.
A maximum of one pair of columns can be joined between two tables using the ON clause

C.
Both USING and ON clause can be used for equijoins and nonequijoins

D.
The WHERE clause can be used to apply additional conditions in SELECT statement
containing the ON or the USING clause

Explanation:
Creating Joins with the USING Clause
If several columns have the same names but the data types do not match, use the USING clause
to specify the columns for the equijoin.
Use the USING clause to match only one column when more than one column matches.
The NATURAL JOIN and USING clauses are mutually exclusive
Using Table Aliases with the USING clause
When joining with the USING clause, you cannot qualify a column that is used in the USING
clause itself. Furthermore, if that column is used anywhere in the SQL statement, you cannot alias
it. For example, in the query mentioned in the slide, you should not alias the location_id column in
the WHERE clause because the column is used in the USING clause.
The columns that are referenced in the USING clause should not have a qualifier (table name
oralias) anywhere in the SQL statement.
Creating Joins with the ON Clause
The join condition for the natural join is basically an equijoin of all columns with the same name.
Use the ON clause to specify arbitrary conditions or specify columns to join. ANSWER C
The join condition is separated from other search conditions. ANSWER D

The ON clause makes code easy to understand.



Leave a Reply 0

Your email address will not be published. Required fields are marked *