<database name="StudentsAtTheUW">

<createdby name="Alon Halevy"/>

<Schema>
  
  <table name="Students">
	<column name="ID" type="Integer" key="yes">
	  <comment>
	    The student ID is key for all students in the UW.
	  </comment>
	</column>
	
	<column name="Name" type="String" key="no">
	  <comment> 
	    The name of the student.
	  </comment>
	</column>
  </table>

  <table name="Signup">
    <column name="StudentID" type="Integer" key="no">
	</column>
	<column name="ClassSignedUp" type="String" key="no">
	</column>
  </table>

  <table name="Classes">
     <column name="Code" type="String" key="yes">
	   <comment> The class identifier, such as cse444. </comment>
	 </column>
	 <column name="Instructor" type="String" key="no">
	    <comment> The name of the instructor. </comment>
	 </column>
  </table>

  <foreignkeyconstraint>
    <source table="Signup">
	  <column name="StudentID"/>
	</source>
	<target table="Student">
	  <column name="ID"/>
	</target>
    <comment> 
	  Every student that has signed up for a class must have a record in the Student table.
	</comment>
  </foreignkeyconstraint>

  <foreignkeyconstraint>
    <source table="Signup">
	  <column name="ClassSignedUp"/>
	</source>
	<target table="Classes">
	  <column name="Code"/>
	</target>
  </foreignkeyconstraint>

</Schema>

<Data>

  <Students>
    
	<tuple>
	  <ID> 0235903 </ID>
	  <Name> Kevin Spacey </Name>
	</tuple>

	<tuple>
	  <ID> 0234334</ID>
	  <Name> Billy Crystal </Name>
	</tuple>

  </Students>

  <Signup>

    <tuple>
	  <StudentID> 0235903 </StudentID>
	  <ClassSignedUp> cse444 </ClassSignedUp>
	</tuple>

	<tuple>
	  <StudentID> 0234334 </StudentID>
	  <ClassSignedUp> cse451 </ClassSignedUp>
	</tuple>

  </Signup>

  <Classes>
  
    <tuple>
	  <Code> cse444 </Code>
	  <Instructor> Alon Halevy </Instructor>
	</tuple>

	<tuple>
	  <Code> cse451 </Code>
	  <Instructor> Steven Gribble </Instructor>
	</tuple>

  </Classes>

</Data>

</database>