This repository has been archived on 2023-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
2020-10-21 04:46:54 +00:00
|
|
|
-- Your SQL goes here
|
|
|
|
|
|
|
|
CREATE TABLE employees (
|
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
name VARCHAR NOT NULL,
|
|
|
|
role VARCHAR NOT NULL
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE employee_infos (
|
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
employee_id SERIAL NOT NULL,
|
|
|
|
locale VARCHAR NOT NULL,
|
|
|
|
name VARCHAR NOT NULL,
|
2020-10-21 05:15:05 +00:00
|
|
|
role VARCHAR NOT NULL,
|
2020-10-21 04:46:54 +00:00
|
|
|
|
|
|
|
CONSTRAINT employee_id_fk FOREIGN KEY (employee_id) REFERENCES employees(id)
|
|
|
|
);
|
|
|
|
|
2020-10-21 05:29:13 +00:00
|
|
|
CREATE TABLE employee_contacts (
|
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
employee_id SERIAL NOT NULL,
|
|
|
|
name VARCHAR NOT NULL,
|
|
|
|
link VARCHAR NOT NULL,
|
|
|
|
|
|
|
|
CONSTRAINT employee_id_fk FOREIGN KEY (employee_id) REFERENCES employees(id)
|
|
|
|
);
|
|
|
|
|
2020-10-21 04:46:54 +00:00
|
|
|
CREATE UNIQUE INDEX index_employee_infos_on_employee_id_and_locale
|
|
|
|
ON employee_infos USING btree (employee_id, locale);
|
2020-10-21 05:29:13 +00:00
|
|
|
|
|
|
|
CREATE UNIQUE INDEX index_employee_contacts_on_employee_id
|
|
|
|
ON employee_contacts USING btree (employee_id);
|