Re: Simple many to many query...
Quote
... two simple tables in a many-to-many relationship ...
That might be better represented as
three tables - your two "simple" ones plus a third that describes the linkages between the two.
select * from Classes ;
+----+------------------+
| ID | Title |
+----+------------------+
| 1 | Business Studies |
| 2 | Chemistry |
| 3 | History |
+----+------------------+
select * from Students ;
+----+----------+------------+
| ID | Forename | Surname |
+----+----------+------------+
| 77 | Pebbles | Flintstone |
| 88 | Bam Bam | Rubble |
+----+----------+------------+
select Class_ID, Student_ID from Enrolments ;
+----------+------------+
| Class_ID | Student_ID |
+----------+------------+
| 2 | 77 |
| 1 | 88 |
| 2 | 88 |
+----------+------------+
Regards, Phill W.
Subject
Written By
Posted
November 25, 2013 09:06AM
November 25, 2013 11:58AM
Re: Simple many to many query...
November 28, 2013 06:50AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.