SHARE
TWEET

Untitled

a guest Jun 18th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*exercicio 1*/
  2. create table categorias
  3. (codCategoria integer auto_increment not null,
  4. nome varchar(45) not null,
  5. descricao varchar(45) not null,
  6. PRIMARY KEY(codCategoria));
  7.  
  8. create table Produtos
  9. (codProduto integer auto_increment not null,
  10. codCategoria integer not null,
  11. nome varchar(45) not null,
  12. preco double(4,4) not null,
  13. PRIMARY KEY(codProduto),
  14. FOREIGN KEY (codCategoria) references categorias(codCategoria));
  15.  
  16. create table Clientes
  17. (codCliente integer auto_increment not null,
  18. nome varchar(45) not null,
  19. telefone varchar(45) not null,
  20. limiteCredito double (4,0) not null,
  21. PRIMARY KEY(codCliente));
  22.  
  23. create table Pedidos
  24. (numPedido integer auto_increment not null,
  25. codCliente integer not null,
  26. data date not null,
  27. PRIMARY KEY(numPedido),
  28. foreign key (codCliente) references clientes(codCliente));
  29.  
  30. create table ProdutoPedido
  31. (numPedido integer not null,
  32. codCliente integer not null,
  33. dataa date not null,
  34. quantidade integer not null,
  35. PRIMARY KEY(codCliente, numPedido),
  36. foreign key(codCliente) references clientes(codCliente),
  37. foreign key(numPedido) references pedidos(codCliente));
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top