-1
CREATE TABLE Enrollment
(
    OfferNo  NUMBER(10)  NOT NULL,
    StdNo    CHAR(11)    NOT NULL,
    EnrGrade NUMBER(3,2) NULL,

    CONSTRAINT EnrollmentPK 
        PRIMARY KEY (OfferNo, StdNo),
    CONSTRAINT OfferingFK 
        FOREIGN KEY (OfferNo) REFERENCES Offering
                ON DELETE CASCADE
                ON UPDATE CASCADE,
    CONSTRAINT StudentFK 
        FOREIGN KEY (StdNo) REFERENCES Student
                ON DELETE CASCADE
                ON UPDATE CASCADE
);
4

1 回答 1

1

您缺少约束所指的列:

CREATE TABLE Enrollment(
    OfferNo       NUMBER(10)       NOT NULL,
    StdNo         CHAR(11)      NOT NULL,
    EnrGrade      NUMBER(3,2)  NULL,
    CONSTRAINT EnrollmentPK PRIMARY KEY (OfferNo, StdNo),
    CONSTRAINT OfferingFK FOREIGN KEY (OfferNo) REFERENCES Offering(OfferNo)
    -- Here --------------------------------------------------------^
                          ON DELETE CASCADE
                          ON UPDATE CASCADE,
    CONSTRAINT StudentFK FOREIGN KEY (StdNo) REFERENCES Student(StdNo)
    -- And here ------------------------------------------------^
                          ON DELETE CASCADE
                          ON UPDATE CASCADE
);
于 2018-09-02T18:50:29.827 回答