Databases Reference
In-Depth Information
6.
Execute the same join between the two tables with a different condition:
SET AUTOT TRACE EXP STAT
SELECT C.CUST_FIRST_NAME, C.CUST_LAST_NAME, N.COUNTRY_NAME
FROM sh.MY_CUSTOMERS C, sh.MY_COUNTRIES N
WHERE N.COUNTRY_ID BETWEEN C.COUNTRY_ID
AND C.COUNTRY_ID + 10;
7.
Clean the
SH
schema:
DROP TABLE sh.MY_COUNTRIES;
DROP TABLE sh.MY_CUSTOMERS;
How it works...
We have created two tables,
MY_CUSTOMERS
and
MY_COUNTRIES
, to experiment with some
of the different types of joins.
In the query in step 4, the
MY_CUSTOMERS
table is joined with
CUSTOMERS
, using an equi-join
on the primary key (the field
CUST_ID
).
We can see the execution plan and statistics for this query in the following screenshot: