Write a postgre sql statement to create a table employees, including columns 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 does not contain any duplicate value at the time of insertion, and the foreign key column department_id, reference by the column department_id of departments table, can contain only those values which exist in the departments table and another foreign key column job_id, referenced by the column job_id of jobs table, can contain only those values which exist in the jobs table.
Assume that the structure of two tables departments and jobs.
Column | Type | Modifiers
-----------------+-----------------------+-----------------------
department_id | numeric(4,0) | not null
department_name | character varying(30) | not null
manager_id | numeric(6,0) | default NULL::numeric
location_id | numeric(4,0) | default NULL::numeric\
Indexes:
"departments_pkey" PRIMARY KEY, btree (department_id)
Column | Type | Modifiers
------------+-----------------------+----------------------------------------
job_id | character varying(10) | not null default ''::character varying
job_title | character varying(35) | not null
min_salary | numeric(6,0) | default NULL::numeric
max_salary | numeric(6,0) | default NULL::numeric
Indexes:
"jobs_pkey" PRIMARY KEY, btree (job_id)
Output:
Here is the command to see the structure of the created table :