-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
21 lines (19 loc) · 781 Bytes
/
schema.sql
File metadata and controls
21 lines (19 loc) · 781 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
-- =============================================================
-- Section 5 — Modifying Data
-- =============================================================
-- A small e-commerce `product` table you'll UPDATE and DELETE
-- against. Different domain from the previous sections so you
-- see schema variety.
-- =============================================================
DROP SCHEMA IF EXISTS sqlf_modifying CASCADE;
CREATE SCHEMA sqlf_modifying;
SET search_path TO sqlf_modifying;
CREATE TABLE product (
id INTEGER,
name VARCHAR(100) NOT NULL,
category VARCHAR(50) NOT NULL,
price NUMERIC(10, 2) NOT NULL,
stock INTEGER NOT NULL,
is_active BOOLEAN NOT NULL,
last_restocked DATE
);