CREATE TABLE office(
office_id INTEGER NOT NULL PRIMARY KEY
,office_name VARCHAR(15) NOT NULL
);
CREATE TABLE category(
category_id INTEGER NOT NULL PRIMARY KEY
,category_name VARCHAR(15) NOT NULL
);
CREATE TABLE employee(
employee_id INTEGER NOT NULL
,Firstname text NOT NULL
,birthdate DATE NOT NULL
,Register text NOT NULL
,Lastname text NOT NULL
,Gender text NOT NULL
,category_id INTEGER NOT NULL
,office_id INTEGER NOT NULL
,user_name text NOT NULL
,pass_word text NOT NULL,
foreign key(category_id) references category(category_id),
foreign key(office_id) references office(office_id),
primary key(employee_id,category_id,office_id),
UNIQUE(Firstname)
);
After this i want to create this table but it gives me "there is no unique constraint matching given keys for referenced table "employees" this mistake i don't know how to fix this?
CREATE TABLE employee_phone(
employee_id INTEGER NOT NULL
,phone INTEGER NOT NULL,
foreign key(employee_id) references employees(employee_id),
primary key(employee_id)
);