Write a postgre SQL statement to create a table employees, including employee_id, first_name, last_name, email, phone_number hire_date, job_id, salary, commission, manager_id and department_id and make sure that, the employee_id column did not contain any duplicate values at the time of insertion and the foreign key columns combined by department_id and manager_id columns contain only those unique combination values, which combinations exist in the departments table.
Assume the structure of departments table below.
Column | Type | Modifiers
-----------------+-----------------------+--------------------------------
department_id | numeric(4,0) | not null
department_name | character varying(30) | not null
manager_id | numeric(6,0) | not null default NULL::numeric
location_id | numeric(4,0) | default NULL::numeric
Indexes:
"departments_pkey" PRIMARY KEY, btree (department_id, manager_id)
Output:
Here is the command to see the structure of the created table :