-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquery.sql
More file actions
44 lines (39 loc) · 932 Bytes
/
Copy pathquery.sql
File metadata and controls
44 lines (39 loc) · 932 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
create database dindin;
create table usuarios (
id serial primary key,
nome varchar(150) not null,
email text not null unique,
senha text not null
);
drop table usuarios;
create table categorias (
id serial primary key,
descricao text not null
);
create table transacoes (
id serial primary key,
descricao text not null,
valor integer not null, --em centavos
data Timestamp,
categoria_id integer not null references categorias(id),
usuario_id integer not null references usuarios(id),
tipo text not null -- entrada ou saída
);
insert into categorias (descricao) values
('Alimentação'),
('Assinaturas e Serviços'),
('Casa'),
('Mercado'),
('Cuidados Pessoais'),
('Educação'),
('Família'),
('Lazer'),
('Pets'),
('Presentes'),
('Roupas'),
('Saúde'),
('Transporte'),
('Salário'),
('Vendas'),
('Outras receitas'),
('Outras despesas');