One-One, One-Many and Many-Many Relations in XML Schema - Implementing a “One to Many” relation in XML Schema: the schema (Page 4 of 6 )
Until now, we have looked at only the one to one relation. Now, it is time to look at implementing the one to many (or conversely many to one) relation.
I already explained similar types of hierarchies in my previous sections; I would like to show you the most important bits now. The most important code fragment to concentrate on from the above schema is the following:
The above code fragment says that the “deptno” in “Employee” should “refer” to the values in “PK_Dept_Deptno” (which is nothing but “deptno” in “dept”) for integrity. We also named the relation “FK_deptEmployee.” It became a one to many relation because the “deptno” in “Employee” is not a primary key (or unique key).
How about an XML document for the above XML Schema? The next section shows you that.