CREATE TABLE EVENT ( EventName VARCHAR2(100) NOT NULL, VenueName VARCHAR2(100) NOT NULL, CONSTRAINT EventPK PRIMARY KEY (EventName), CONSTRAINT VenueFK FOREIGN KEY (VenueName) REFERENCES STUDENT(VenueName), CONSTRAINT EventPK FOREIGN KEY (EventName) REFERENCES STUDENT(EventName) );
It looks like you're trying to create a table named EVENT
with some constraints, but there are a few issues in your SQL statement. Specifically, you are trying to create foreign key constraints that reference the STUDENT
table, but the STUDENT
table is not defined in your statement. Additionally, you cannot have two constraints with the same name (EventPK
is used for both the primary key and one of the foreign keys).
Here’s a corrected version of your SQL statement, assuming that the STUDENT
table exists and has the appropriate columns:
CREATE TABLE EVENT (
EventName VARCHAR2(100) NOT NULL,
VenueName VARCHAR2(100) NOT NULL,
CONSTRAINT EventPK PRIMARY KEY (EventName),
CONSTRAINT VenueFK FOREIGN KEY (VenueName) REFERENCES STUDENT(VenueName),
CONSTRAINT EventFK FOREIGN KEY (EventName) REFERENCES STUDENT(EventName)
);
EventPK
to EventFK
to avoid naming conflicts.STUDENT
table exists and has columns VenueName
and EventName
that can be referenced.STUDENT
table is created before you create the EVENT
table.EventName
and VenueName
in the STUDENT
table are not meant to be foreign keys, you may need to adjust the foreign key constraints accordingly.VenueName
must exist in the STUDENT
table, ensure that the STUDENT
table has a corresponding VenueName
column.