Sql Error: Ora-00922: Missing Or Invalid Option Creating Composite Key
I am trying to create a composite primary key for my table using emp_id and licence_cert_no why is this not working? CREATE TABLE employee_licence_certificate(emp_id NUMBER(4) REFE
Solution 1:
The CONSTRAINT clause needs to go inside the parentheses:
CREATE TABLEemployee_licence_certificate(
emp_id NUMBER(4) REFERENCES employee(emp_id)
, licence_cert_code VARCHAR2(6) REFERENCES licence_certificate(licence_cert_code)
, date_earned DATE NOT NULL
, CONSTRAINT pk_emp_licence PRIMARY KEY(emp_id, licence_cert_code)
);
Post a Comment for "Sql Error: Ora-00922: Missing Or Invalid Option Creating Composite Key"