-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdb__init.sql
20 lines (19 loc) · 984 Bytes
/
db__init.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
CREATE TABLE IF NOT EXISTS public.department(
dept_no integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
name character varying(100) COLLATE pg_catalog."default" NOT NULL,
budget double precision NOT NULL,
CONSTRAINT "DEPARTMENT_pkey" PRIMARY KEY (dept_no)
);
CREATE TABLE IF NOT EXISTS public.employee(
emp_no integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
dept_no integer NOT NULL,
first_name character varying(100) COLLATE pg_catalog."default" NOT NULL,
last_name character varying(100) COLLATE pg_catalog."default" NOT NULL,
hire_date date NOT NULL,
salary double precision NOT NULL,
CONSTRAINT "EMPLOYEE_pkey" PRIMARY KEY (emp_no),
CONSTRAINT "FK_DEPARTMENT_EMPLOYEE" FOREIGN KEY (dept_no)
REFERENCES public.department (dept_no) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
);