You are on page 1of 3

DROP

DROP
DROP
DROP
DROP
DROP

TABLE
TABLE
TABLE
TABLE
TABLE
TABLE

Subject_areas0875
Staff0875
Specialisms0875
Rooms0875
Buildings0875
Classes0875

CREATE TABLE Subject_areas0875 (


subject_area0875_id char(2) NOT NULL PRIMARY KEY,
name0875 char(10),
head0875 char(2)
);
CREATE TABLE Staff0875 (
staff0875_id char(2) NOT NULL PRIMARY KEY,
name0875 char(15),
subject_area0875 char(2),
CONSTRAINT fk_substaff0875 FOREIGN KEY (subject_area0875)
REFERENCES Subject_areas0875(subject_area0875_id)
);
ALTER TABLE Subject_areas0875 ADD CONSTRAINT fk_staffsub0875 FOREIGN KEY (head08
75)
REFERENCES Staff0875(staff0875_id) INITIALLY DEFERRED DEFERRABLE;
ALTER TABLE Subject_areas0875 ADD new_column char(2);
ALTER TABLE Subject_areas0875 DROP COLUMN new_column;
CREATE TABLE Specialisms0875 (
specialism0875_id char(2) NOT NULL PRIMARY KEY,
name0875 char(10),
level0875 char(2),
staff0875 char(2),
CONSTRAINT fk_staffspec0875 FOREIGN KEY (staff0875)
REFERENCES Staff0875(staff0875_id)
);
CREATE TABLE Buildings0875 (
building0875_id char(1) NOT NULL PRIMARY KEY,
name0875 char(15),
);
CREATE TABLE Rooms0875 (
room0875_id char(2) NOT NULL PRIMARY KEY,
number_of_chairs0875 char(2),
number_of_tables0875 char(2),
facilities0875 char(10) DEFAULT "None"
building0875 char(2),
CONSTRAINT fk_roombuild0875 FOREIGN KEY (building0875)
REFERENCES Buildings0875(building0875_id)
);

CREATE TABLE Classes0875 (


class0875_id char(2) NOT NULL PRIMARY KEY,
name0875 char(3),

day0875 char(10),
session0875 char(1),
staff0875 char(2),
room0875 char(2),
specialism0875 char(2),
CONSTRAINT fk_staffclass FOREIGN KEY (staff0875)
REFERENCES Staff0875(staff0875_id),
CONSTRAINT fk_roomclass FOREIGN KEY (room0875)
REFERENCES Rooms0875(room0857_id),
CONSTRAINT fk_specclass FOREIGN KEY (specialism0875)
REFERENCES Specialisms0875(specialism0875_id)
);

INSERT
VALUES
INSERT
VALUES

INTO staff0875 (name0875)


("Ricky");
INTO staff0875 (name0875)
("Bubbles");

INSERT
VALUES
INSERT
VALUES
INSERT
VALUES
INSERT
VALUES

INTO Subject_areas0875
("Humanities","1");
INTO Subject_areas0875
("Science","2");
INTO Subject_areas0875
("Languages","1");
INTO Subject_areas0875
("Core subjects","2");

INSERT
VALUES
INSERT
VALUES

INTO staff0875 (name0875,subject_area0875)


("Cory","1");
INTO staff0875 (name0875,subject_area0875)
("Trevor","2");

INSERT
VALUES
INSERT
VALUES
INSERT
VALUES

INTO specialisms0875 (name0875,level0875,staff0875)


("Chemistry","12","1")
INTO specialisms0875 (name0875,level0875,staff0875)
("Maths","3","2")
INTO specialisms0875 (name0875,level0875,staff0875)
("English,"4","3")

INSERT
VALUES
INSERT
VALUES
INSERT
VALUES

INTO Buildings0875 (name)


("A")
INTO Buildings0875 (name)
("B")
INTO Buildings0875 (name)
("C")

(name0875,head0875)
(name0875,head0875)
(name0875,head0875)
(name0875,head0875)

INSERT INTO Rooms0875 (number_of_tables0875,number_of_chairs0875,facilities0875,


building0875)
VALUES ("1","10","sports","1")
INSERT INTO Rooms0875 (number_of_tables0875,number_of_chairs0875,facilities0875,
building0875)
VALUES ("5","15","art","2")
INSERT INTO Rooms0875 (number_of_tables0875,number_of_chairs0875,facilities0875,
building0875)
VALUES ("2","3","science","3")

CREATE
INSERT
INSERT
;
INSERT
");

SEQUENCE SEQ_SESSIONID START WITH 1 INCREMENT BY 1;


INTO Classes VALUES ("10A","Monday",SEQ_SESSIONID.NEXTVAL, "1", "1","1");
INTO Classes VALUES ("10A","Tuesday",SEQ_SESSIONID.NEXTVAL, "2", "1","1")
INTO Classes VALUES ("10A","Wednesday",SEQ_SESSIONID.NEXTVAL, "2", "1","1

You might also like