我是 SQL 新手,在 Navicat for Oracle 中出现此错误。
ORA-00904: : 无效的标识符
DROP TABLE Series CASCADE CONSTRAINTS;
DROP TABLE User1 CASCADE CONSTRAINTS;
DROP TABLE Following CASCADE CONSTRAINTS;
DROP TABLE Episode CASCADE CONSTRAINTS;
--DROP TABLE BUNGALOW CASCADE CONSTRAINTS;
--DROP TABLE Watched CASCADE CONSTRAINTS;
CREATE TABLE Series
( SeriesID NUMBER(5) primary key,
Name VARCHAR2(100) NOT NULL,
Status VARCHAR2(15),
Genre VARCHAR2(100),
Country VARCHAR2(100),
Network VARCHAR2(100),
Runtime VARCHAR2(25)
);
CREATE TABLE User1(
UserID NUMBER(5) primary key,
Username VARCHAR2(100) NOT NULL,
Country1 varchar2(100),
Gender VARCHAR2(10) NOT NULL,
Birthday VARCHAR2(100),
Timezone VARCHAR2(100),
About_me VARCHAR2(300),
Password VARCHAR2(100) NOT NULL
);
CREATE TABLE Following (
UserID NUMBER(5) NOT NULL,
SeriesID NUMBER(5) NOT NULL,
Ignore1 CHAR(1) NOT NULL,
constraint Following_pk primary key(UserID, SeriesID),
constraint Following_fk1 foreign key(UserID) REFERENCES User1(UserID),
constraint Following_fk2 foreign key(SeriesID) REFERENCES Series(SeriesID)
);
CREATE TABLE Episode(
SeriesID NUMBER(5) NOT NULL,
Season NUMBER(2) NOT NULL,
Episode NUMBER(2) NOT NULL,
Name varchar2(100) NOT NULL,
Airdate DATE,
Summary varchar2(500),
constraint episode_pk primary key(SeriesID, Season, Episode),
constraint episode_fk foreign key(SeriesID) REFERENCES Series(SeriesID)
);
CREATE TABLE Watched(
UserID NUMBER(5) NOT NULL,
SeriesID NUMBER(5) NOT NULL,
Season NUMBER(2) NOT NULL,
Episode NUMBER(2) NOT NULL,
constraint watched_pk primary key(UserID, SeriesID, Season, Episode),
constraint watched_fk1 foreign key(UserID) REFERENCES User1(UserID),
constraint watched_fk2 foreign key(SeriesID) REFERENCES Episode(SeriesID),
constraint watched_fk3 foreign key(Season) REFERENCES Episode(Season),
constraint watched_fk4 foreign key(Episode) REFERENCES Episode(Episode),
);
创建 Watched 表时出现错误。我想这与情节表中的多个外键有关,但我似乎无法弄清楚。