Then the natural join of R and S , which joins those tuples from R and S which have equal B -values, is expressed by
|
|
SELECT DISTINCT A1, ..., Am, R.B1, ..., R.Bm, C1, ..., Cl
FROM R, S WHERE R.B1 = S.B1 AND ... AND R.Bm = S.Bm;
SQL> DROP TABLE enrollment;
SQL> CREATE TABLE enrollment (
2 student_id CHAR(4) PRIMARY KEY,
3 course_no CHAR(4),
4 major CHAR(6) );
SQL> INSERT INTO enrollment VALUES (
2 '1', '101', 'No' );
SQL> SELECT DISTINCT s.student_id, class, major
2 FROM student s, enrollment e
3 WHERE s.student_id = e.student_id;
|
|