forked from zanfranceschi/rinha-de-backend-2024-q1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.sql
42 lines (36 loc) · 864 Bytes
/
init.sql
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
30
31
32
33
34
35
36
37
38
39
40
41
42
CREATE TABLE clientes (
id serial4 NOT NULL,
nome varchar(50) NOT NULL,
limite int4 NOT NULL,
saldo int4 NOT NULL DEFAULT 0,
CONSTRAINT clientes_pkey PRIMARY KEY (id)
);
CREATE TABLE transacoes (
id serial4 NOT NULL,
cliente_id int4 NOT NULL,
valor int4 NOT NULL DEFAULT 0,
descricao varchar(10) NOT NULL,
tipo varchar(1) NOT NULL,
realizada_em date NOT NULL DEFAULT 'now' :: text :: date,
CONSTRAINT transacoes_pkey PRIMARY KEY (id)
);
INSERT INTO
clientes (nome, limite)
VALUES
('o barato sai caro', 1000 * 100);
INSERT INTO
clientes (nome, limite)
VALUES
('zan corp ltda', 800 * 100);
INSERT INTO
clientes (nome, limite)
VALUES
('les cruders', 10000 * 100);
INSERT INTO
clientes (nome, limite)
VALUES
('padaria joia de cocaia', 100000 * 100);
INSERT INTO
clientes (nome, limite)
VALUES
('kid mais', 5000 * 100);