madochan

sql-checkout-db

Nov 11th, 2025 (edited)
1,304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PostgreSQL 0.83 KB | Software | 0 0
  1. create table produto (
  2. id_produto smallserial primary key,
  3. nome_produto varchar(255) not null,
  4. valor_unidade decimal(6,2) not null,
  5. descricao varchar(255) null
  6. )
  7.  
  8. create table cliente (
  9. id_cliente smallserial primary key,
  10. nome varchar(255) not null,
  11. email varchar(255) not null unique,
  12. cpf_cnpj varchar(18) not null unique,
  13. cep varchar(9) not null,
  14. num_residencia varchar(20) not null,
  15. id_cliente_asaas varchar(255) null
  16. )
  17.  
  18. create table pedido (
  19. id_pedido smallserial primary key,
  20. quantidade smallint not null default 1,
  21. valor_total decimal(7,2) not null,
  22. status_pagamento varchar(50) not null default 'pendente',
  23. data_compra date not null default current_date,
  24. id_pagamento_asaas varchar(255) null unique,
  25. id_cliente smallint not null references cliente(id_cliente),
  26. id_produto smallint not null references produto(id_produto)
  27. )
Advertisement
Add Comment
Please, Sign In to add comment