One-One, One-Many and Many-Many Relations in XML Schema - Implementing a Many to Many relation in XML Schema: the schema (Page 6 of 6 )
Until now, we have gone through only one to one and one to many relations. Now, it is time to look at implementing a many to many relation. Many to many relations are a bit complicated when compared with the above two.
For the sake of this example, I am taking the same concept of the “pubs” database (demonstration database) existing in Microsoft SQL Server. Concisely, it has three tables: “Titles,” “Authors” and “TitleAuthors”. It also has relations in between three of them. I would like to have the same concept implemented in my schema (instead of in the database).
Finally, here are the primary keys and foreign keys -- the leftovers of the schema presented above. The following is the fragment schema you need to add to the schema defined above (at the appropriate place only).
You can observe carefully that I have three primary keys and two foreign keys to represent a “many-many” relation (of course, you can have even more).
Any comments, suggestions, feedback, bugs, errors are highly appreciated at email@example.com
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.