我在弄清楚这些表应该为我的脚本添加的顺序时遇到了可怕的麻烦,我现在将发布脚本,如果有人可以帮助他们应该被删除的顺序,那将是一个很大的帮助
drop table Registered_Student;
drop table EducateYou_VideoRating;
drop table EducateYou_Video;
drop table EducateYou_Violation;
drop table EducateYou_Member;
drop table Violation_Type;
drop table EducateYou_Comment;
drop table EducateYou_FollowList;
drop table EducateYou_Group;
drop table EducateYou_Admin;
commit;
create table EducateYou_Violation
(
violationId number (9),
violationStatus char(1) DEFAULT 'X',
videoId number(9),
groupId number (9),
commentId number(9),
CONSTRAINT pk_violationId PRIMARY KEY (violationId),
CONSTRAINT fk_x_videoId FOREIGN KEY (videoId) REFERENCES EducateYou_Video,
CONSTRAINT fk_y_groupId FOREIGN KEY (groupId) REFERENCES EducateYou_Group,
CONSTRAINT fk_z_commentId FOREIGN KEY (commentId) REFERENCES EducateYou_Comment
);
create table EducateYou_Video(
videoId number(9),
videoRef varchar2(50) NOT NULL,
videoTitle varchar2(15) NOT NULL,
uploadDate DATE NOT NULL,
videoStatus char(1) DEFAULT 'X',
videoCategory varchar2(15) NOT NULL,
regNo number(6) NOT NULL,
AdminId number(9),
commentId number(9),
CONSTRAINT pk_videoId PRIMARY KEY (videoId),
CONSTRAINT fk_r_regNo FOREIGN KEY (regNo) REFERENCES EducateYou_Member,
CONSTRAINT fk_p_AdminId FOREIGN KEY (AdminId) REFERENCES EducateYou_Admin,
CONSTRAINT fk_n_commentId FOREIGN KEY (commentId) REFERENCES EducateYou_Comment
);
create table EducateYou_VideoRating(
rating number(2) NOT NULL,
regNo number(9),
videoId number(9),
CONSTRAINT pk_video_rating PRIMARY KEY (videoId, regNo),
CONSTRAINT fk_x_videoId FOREIGN KEY (videoId) REFERENCES EducateYou_Video,
CONSTRAINT fk_z_regNo FOREIGN KEY (regNo) REFERENCES EducateYou_Member
);
create table EducateYou_Admin
(
AdminId number(9),
firstName varchar2(15),
surname varchar2(15),
adminActions varchar2(40),
CONSTRAINT pk_AdminId PRIMARY KEY (AdminId)
);
create table EducateYou_Group(
groupID number(5) NOT NULL,
groupname varchar2(15) NOT NULL,
regNo number(6) NOT NULL,
CONSTRAINT pk_groupID PRIMARY KEY (groupID),
CONSTRAINT fk_i_regNo FOREIGN KEY (regNo) REFERENCES EducateYou_Member
);
create table EducateYou_Comment(
commentId number(9),
commentStatus char(1) DEFAULT 'A',
commentTime timestamp,
counter number(5) DEFAULT 5,
educateYouComment varchar2(50),
regNo number(6) NOT NULL,
CONSTRAINT pk_commentId PRIMARY KEY (commentId),
CONSTRAINT fk_b_regNo FOREIGN KEY (regNo) REFERENCES EducateYou_Member
);
create table EducateYou_FollowList(
followListID number(9),
regNo number(9),
CONSTRAINT pk_followListID PRIMARY KEY (followListID),
CONSTRAINT fk_z_regNo FOREIGN KEY (regNo) REFERENCES EducateYou_Member
);
create table Violation_Type
(
violation_TypeId varchar2(9),
violationId number(9),
CONSTRAINT pk_violation_TypeId PRIMARY KEY (violation_TypeId, violationId ),
CONSTRAINT fk_m_violationId FOREIGN KEY (violationId) REFERENCES EducateYou_Violation
);
create table EducateYou_Member
(
regNo number(6),
status char(1) DEFAULT 'A',
collegeId varchar2(9) NOT NULL,
CONSTRAINT pk_regNo PRIMARY KEY (regNo),
CONSTRAINT fk_l_collegeId FOREIGN KEY (collegeId) REFERENCES Registered_Student
);
create table Registered_Student
(
collegeId varchar2(9),
password varchar2(9) NOT NULL,
firstname varchar2(20) NOT NULL,
surname varchar2(20) NOT NULL,
dob date NOT NULL,
street varchar2(25) NOT NULL,
town varchar2(10) NOT NULL,
county varchar2(15) NOT NULL,
college varchar2(30) NOT NULL,
course varchar2(10) NOT NULL,
CONSTRAINT pk_collegeId PRIMARY KEY (collegeId)
);