Skip to content

Instantly share code, notes, and snippets.

@abadongutierrez
Created August 29, 2016 06:11
Show Gist options
  • Save abadongutierrez/439fef2fd9caa719b3fc8d2e1846f7ae to your computer and use it in GitHub Desktop.
Save abadongutierrez/439fef2fd9caa719b3fc8d2e1846f7ae to your computer and use it in GitHub Desktop.
CREATE TABLE department
(
department_id serial NOT NULL,
name text NOT NULL,
PRIMARY KEY (department_id)
);
CREATE TABLE employee
(
employee_id serial NOT NULL,
first_name text NOT NULL,
last_name text NOT NULL,
hire_date date NOT NULL,
department_id integer NOT NULL,
FOREIGN KEY (department_id) REFERENCES department (department_id) ON UPDATE NO ACTION ON DELETE NO ACTION,
PRIMARY KEY (employee_id)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment