<?xml version="1.0" standalone="no"?>

<!DOCTYPE xmlsql SYSTEM "xmlsql.dtd">

<xmlsql>

<retract construct="table" name="supervises"/>
<retract construct="table" name="phd"/>
<retract construct="table" name="supervisor"/>

<update label="create supervisor">
CREATE TABLE supervisor
(  sno INTEGER NOT NULL,
   sname VARCHAR(20) NOT NULL,
   dept VARCHAR(20) NOT NULL,
   CONSTRAINT supervisor_pk PRIMARY KEY (sno)
)
</update>

<update label="create phd">
CREATE TABLE phd
(  id INTEGER NOT NULL,
   name VARCHAR(20) NOT NULL,
   left_on DATETIME NULL,
   title VARCHAR(20) NOT NULL,
   CONSTRAINT phd_pk PRIMARY KEY (id)
)
</update>

<update label="create supervises">
CREATE TABLE supervises
(  sno INTEGER NOT NULL,
   id INTEGER NOT NULL,
   CONSTRAINT supervises_pk PRIMARY KEY (sno,id),
   CONSTRAINT supervises_supervisor_fk FOREIGN KEY (sno) REFERENCES supervisor,
   CONSTRAINT supervises_phd_fk FOREIGN KEY (id) REFERENCES phd
)
</update>

<update>
INSERT INTO supervisor VALUES (1,'pjm','Computing')
</update>

<update>
INSERT INTO supervisor VALUES (3,'yg','Computing')
</update>

<update>
INSERT INTO phd VALUES (101,'vc',null,'Grid Computing')
</update>

<update>
INSERT INTO phd VALUES (102,'nr',null,'Data Mining')
</update>

<update>
INSERT INTO phd VALUES (103,'nnyt','30-05-2003','Pathway Optimisation')
</update>

<update>
INSERT INTO supervises VALUES (3,101)
</update>

<update>
INSERT INTO supervises VALUES (1,102)
</update>

<update>
INSERT INTO supervises VALUES (1,103)
</update>

<query>
<sql>SELECT * FROM supervisor</sql>
</query>

<query>
<sql>SELECT * FROM phd</sql>
</query>

<query>
<sql>SELECT * FROM supervises</sql>
</query>
</xmlsql>
