I'm new to oracle, I created two tables using the following queries:
CREATE TABLE employee ( emp_name VARCHAR(20) NOT NULL, street VARCHAR(50) NOT NULL, city VARCHAR(20) NOT NULL, PRIMARY KEY(emp_name) )
and
CREATE TABLE company ( comp_name VARCHAR(20) NOT NULL, city VARCHAR(20) NOT NULL, PRIMARY KEY(comp_name) )
Now I'm trying to create another table using some foreign keys,
CREATE TABLE works ( emp_name varchar(20) NOT NULL, comp_name varchar(20) NOT NULL, salary int(10) NOT NULL, FOREIGN KEY(emp_name) REFERENCES employee(emp_name), FOREIGN KEY(comp_name) REFERENCES company(comp_name) )
Getting ERROR: ORA-00907: Missing Right Parentheses
I also tried using
CREATE TABLE works ( emp_name varchar(20) NOT NULL, comp_name varchar(20) NOT NULL, salary int(10) NOT NULL, constraint wemployee FOREIGN KEY(emp_name) REFERENCES employee(emp_name), constraint wcompany FOREIGN KEY(comp_name) REFERENCES company(comp_name) )
But the same mistake. Can someone tell me where I am going wrong?
source share