-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdump.sql
executable file
·70 lines (53 loc) · 1.42 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
61
62
63
64
65
66
67
68
69
70
CREATE DATABASE pdv2
create table
usuarios(
id serial primary key unique,
nome text,
email text unique,
senha text
);
create table
categorias(
id serial primary key unique,
descricao text
);
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 unique,
descricao text,
quantidade_estoque numeric,
valor numeric,
categoria_id integer references categorias(id)
);
CREATE TABLE
clientes(
id serial primary key unique,
nome text,
email text unique,
cpf text unique,
cep text,
rua text,
numero text,
bairro text,
cidade text,
estado text
);
create table
pedidos(
id serial primary key,
cliente_id int references clientes(id),
observacao text,
valor_total numeric
);
create table
pedido_produtos(
id serial primary key,
pedido_id int references pedidos(id),
produto_id int references produtos(id),
quantidade_produto numeric,
valor_produto numeric
);
ALTER TABLE produtos ADD COLUMN produto_imagem text;