R
and S
is expressed by
SELECT DISTINCT * FROM R EXCEPT SELECT DISTINCT * FROM S; SQL> SELECT DISTINCT * FROM ( SELECT last_name FROM student ) 2 MINUS 3 SELECT DISTINCT * FROM ( SELECT first_name FROM student ); |
R
be a relational schema with attributes A1
, ..., An
, B1
, ..., Bm
and S
a relational schema with attributes B1
, ..., Bm
, C1
, ..., Cl
.
Then the natural join of R and S , which joins those tuples from R and S which have equal B -values, is expressed by
|
|
R.B
is used to specify which occurrence of the respective attribute is meant.
With respect to the natural join, of course, we could have used S.B
as well.
The WHERE
clause then explicitly states that tuples from the
different relations must have identical values with respect to the shared attributes.
A simpler formulation of the natural join is on the right: |
|
Result:
|
The Database includes:
|
The Database includes:
|
I like to keep my vocabulary at hand (nearby). |