-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdump.sql
60 lines (54 loc) · 1.25 KB
/
dump.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
CREATE TABLE usuarios (
id SERIAL PRIMARY KEY,
nome VARCHAR(100) NOT NULL,
email VARCHAR(100) UNIQUE NOT NULL,
senha VARCHAR(100) NOT NULL
);
CREATE TABLE categorias (
id SERIAL PRIMARY KEY,
descricao VARCHAR(100) NOT NULL
);
INSERT INTO categorias (descricao)
VALUES
('Informática'),
('Celulares'),
('Beleza e Perfumaria'),
('Mercado'),
('Livros e Papelaria'),
('Brinquedos'),
('Moda'),
('Bebê'),
('Games');
create table produtos(
id serial primary key,
descricao text not null,
quantidade_estoque int not null,
valor int not null,
categoria_id int references categorias(id)
produto_imagem text unique
);
create table clientes(
id serial primary key,
nome text not null,
email varchar(100) unique not null,
cpf char(11) unique not null,
cep char(8),
rua varchar,
numero int,
bairro varchar,
cidade varchar,
estado char(2)
);
create table pedidos(
id serial primary key,
cliente_id int references clientes(id),
observacao text,
valor_total int
);
create table pedido_produtos(
id serial primary key,
pedido_id int references pedidos(id),
produto_id int references produtos(id),
quantidade_produto integer not null,
valor_produto integer not null
);