Home » Oracle » 1z0-061 » Which two statements are true regarding the USING clause in table joins?
Which two statements are true regarding the USING clause in table joins?(Choose two.)
A. It can be used to join a maximum of three tables.
B. It can be used to restrict the number of columns used in a NATURAL join.
C. It can be used to access data from tables through equijoins as well as nonequijoins.
D. It can be used to join tables that have columns with the same name and compatible data types.
Correct Answer: BD
Explanation/Reference:
Explanation:
NATURAL JOIN operation
A NATURAL JOIN is a JOIN operation that creates an implicit join clause for you based on the common columns in the two tables being joined.
Common columns are columns that have the same name in both tables.
If the SELECT statement in which the NATURAL JOIN operation appears has an asterisk (*) in the select list, the asterisk will be expanded to the following list of columns (in this order):
All the common columns
Every column in the first (left) table that is not a common column
Every column in the second (right) table that is not a common column
An asterisk qualified by a table name (for example, COUNTRIES.*) will be expanded to every column of that table that is not a common column.
If a common column is referenced without being qualified by a table name, the column reference points to the column in the first (left) table if the join is an INNER JOIN or a LEFT OUTER JOIN. If it is a RIGHT OUTER JOIN, unqualified references to a common column point to the column in the second (right) table.
Syntax
TableExpression NATURAL [ { LEFT | RIGHT } [ OUTER ] | INNER ] JOIN { TableViewOrFunctionExpression | ( TableExpression ) }
Examples
If the tables COUNTRIES and CITIES have two common columns named COUNTRY and COUNTRY_ISO_CODE, the following two SELECT statements are equivalent:
SELECT * FROM COUNTRIES NATURAL JOIN CITIES
SELECT * FROM COUNTRIES JOIN CITIES
USING (COUNTRY, COUNTRY_ISO_CODE)
Download Printable PDF. VALID exam to help you PASS.
|
|
CD correct answers
B is incorrect. NATURAL JOIN and USING are mutually exclusive. The whole sense of using NATURAL JOIN is to allow Oracle to find fields with same name and type. USING is designed to specify which fields must be used for JOIN. So these two conditions are mutually exclusive
Correct Answer: BD
C is not correct.
JOIN USING syntax cannot be used to access data from tables through non equi joins.
B is correct.
JOIN USING syntax can be used to restrict the number of columns used in a NATURAL join, use it instead of NATURAL JOIN syntax.
For example NATURAL JOIN use 3 columns for join two tables, but you want to use only one column – so you can using JOIN USING syntax.