|
| 1 | +-- Table: customers |
| 2 | +DROP TABLE IF EXISTS customers; |
| 3 | + |
| 4 | +CREATE TABLE customers |
| 5 | +( |
| 6 | +customer_id integer NOT NULL, |
| 7 | +first_name character varying(50), |
| 8 | +last_name character varying(50) , |
| 9 | +email character varying(50), |
| 10 | +address character varying(100), |
| 11 | +city character varying(50), |
| 12 | +state_province character varying(10), |
| 13 | +CONSTRAINT customers_pkey PRIMARY KEY (customer_id) |
| 14 | +) |
| 15 | + |
| 16 | +TABLESPACE pg_default; |
| 17 | + |
| 18 | +ALTER TABLE customers |
| 19 | +OWNER to postgres; |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | +-- Table: orders |
| 24 | +DROP TABLE IF EXISTS orders; |
| 25 | + |
| 26 | +CREATE TABLE orders |
| 27 | +( |
| 28 | +order_id integer NOT NULL, |
| 29 | +customer_id integer NOT NULL, |
| 30 | +order_date date NOT NULL, |
| 31 | +CONSTRAINT orders_pkey PRIMARY KEY (order_id) |
| 32 | +) |
| 33 | + |
| 34 | +TABLESPACE pg_default; |
| 35 | + |
| 36 | + |
| 37 | +ALTER TABLE orders |
| 38 | +OWNER to postgres; |
| 39 | + |
| 40 | + |
| 41 | +-- Table: product_orders |
| 42 | +DROP TABLE IF EXISTS product_orders; |
| 43 | + |
| 44 | +CREATE TABLE product_orders |
| 45 | +( |
| 46 | +order_id integer NOT NULL, |
| 47 | +product_id integer NOT NULL, |
| 48 | +quantity integer NOT NULL, |
| 49 | +unit_price numeric(10,2) NOT NULL, |
| 50 | +CONSTRAINT product_orders_pkey PRIMARY KEY (order_id, product_id) |
| 51 | +) |
| 52 | + |
| 53 | +TABLESPACE pg_default; |
| 54 | + |
| 55 | +ALTER TABLE product_orders |
| 56 | +OWNER to postgres; |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | +-- Table: products |
| 61 | +DROP TABLE IF EXISTS products; |
| 62 | + |
| 63 | +CREATE TABLE products |
| 64 | +( |
| 65 | +product_id integer NOT NULL, |
| 66 | +product_name character varying COLLATE pg_catalog."default" NOT NULL, |
| 67 | +product_type character varying COLLATE pg_catalog."default" NOT NULL, |
| 68 | +CONSTRAINT products_pkey PRIMARY KEY (product_id) |
| 69 | +) |
| 70 | + |
| 71 | +TABLESPACE pg_default; |
| 72 | + |
| 73 | +ALTER TABLE products |
| 74 | +OWNER to postgres; |
0 commit comments