next up previous
Next: About this document ...

CSG102: $3^{rd}$ Assignment

Due: Thurday, April 15

  1. Consider the following ER-diagram,

    \begin{figure}\centering\epsfig{file=assign3.eps, height=3in, width=5in}\end{figure}

    Sample Solutions for Employee and Project

    CREATE TABLE Employee
    (id CHAR(3) CONSTRAINT id_value CHECK(id LIKE 'E__'),
    salary NUMBER CONSTRAINT salary_value CHECK(salary$>$15000),
    position VARCHAR(10) CONSTRAINT position_nn NOT NULL,
    trainer_id CHAR(3) CONSTRAINT trainer_id_value CHECK(trainer_id LIKE 'E__'),
    department VARCHAR(5),
    PRIMARY KEY (id),
    FOREIGN KEY (trainer_id) REFERENCES Employee,
    FOREIGN KEY (department) REFERENCES Department);



    CREATE TABLE Project
    (id CHAR(3) CONSTRAINT pid_value CHECK(id LIKE 'P__'),
    cost NUMBER CONSTRAINT cost_value CHECK(cost$>$0),
    PRIMARY KEY (cost));

  2. Consider the following db schema,

    Lab(labID, labName, location)

    Students(studentID, fname, lname)

    Guinea-Pig(animalID, description)

    Working(studentID, labID, hours)

    Feeding(studentID, animalID, time, amount_of_food)




next up previous
Next: About this document ...
Evangelos Kanoulas 2004-04-20