-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
29 lines (27 loc) · 1.1 KB
/
schema.sql
File metadata and controls
29 lines (27 loc) · 1.1 KB
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
28
29
-- =============================================================
-- Section 2 — Filtering Data
-- =============================================================
-- Creates the sqlf_filtering schema and a single `person` table.
-- Uses the same shape as section 09 so the mental model carries
-- over, but lives in its own schema so the two sections are
-- independent.
--
-- Load from your shell:
-- psql -U postgres -d sql_exercise \
-- -f 02-sql-fundamentals/02-filtering-data/schema.sql
-- psql -U postgres -d sql_exercise \
-- -f 02-sql-fundamentals/02-filtering-data/seed.sql
-- =============================================================
DROP SCHEMA IF EXISTS sqlf_filtering CASCADE;
CREATE SCHEMA sqlf_filtering;
SET search_path TO sqlf_filtering;
CREATE TABLE person (
id INTEGER,
first_name VARCHAR(50) NOT NULL,
last_name VARCHAR(50) NOT NULL,
gender CHAR(1) NOT NULL,
dob DATE NOT NULL,
email VARCHAR(150),
phone_number VARCHAR(15),
country_of_origin VARCHAR(50) NOT NULL
);