-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathdata.sql
More file actions
27 lines (22 loc) · 802 Bytes
/
Copy pathdata.sql
File metadata and controls
27 lines (22 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
BEGIN;
CREATE TABLE IF NOT EXISTS public.expense
(
userid character varying(50) COLLATE pg_catalog."default",
date date,
expense_type character varying(50) COLLATE pg_catalog."default",
amount numeric(10, 2),
comment character varying(255) COLLATE pg_catalog."default"
);
CREATE TABLE IF NOT EXISTS public.userinfo
(
userid character varying(50) COLLATE pg_catalog."default" NOT NULL,
password character varying(100) COLLATE pg_catalog."default",
user_name character varying(50) COLLATE pg_catalog."default",
CONSTRAINT userinfo_pkey PRIMARY KEY (userid)
);
ALTER TABLE IF EXISTS public.expense
ADD CONSTRAINT expense_userid_fkey FOREIGN KEY (userid)
REFERENCES public.userinfo (userid) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION;
END;