Advertisement
Jonas_3k

/*- Catalogo DB -*/

Feb 2nd, 2019
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 1.27 KB | None | 0 0
  1. create database catalogoloja;
  2. use catalogoloja;
  3.  
  4. create table endereco(
  5.     cep         int primary key not null,
  6.     rua         varchar(255),
  7.     numero      smallint,
  8.     bairro      varchar(255),
  9.     cidade      varchar(255),
  10.     municipio   varchar(255),
  11.     estado      varchar(255),
  12.     uf          varchar(3)
  13. );
  14. create table Pessoa(
  15.     idPessoa        int not null primary key,
  16.     nomePessoa      varchar(255),
  17.     telefone        varchar(255),
  18.     celular         varchar(255),
  19.     enderecofk      int not null,
  20.     foreign key (enderecofk) references endereco(cep)
  21.    
  22. );
  23.  
  24. create table PessoaFisica(
  25.     idPessoaFisica  int not null,
  26.     cpf             varchar(255),
  27.     rg              varchar(255),
  28.     enderecoCli     int not null,    
  29.     foreign key (enderecoCli) references endereco(cep),
  30.     foreign key (idPessoaFisica) references Pessoa(idPessoa)
  31. );
  32.  
  33. create table PessoaJuridica(
  34.     idPessoaJuridica int not null,
  35.     cnpj             varchar(255),
  36.     ie               varchar(255),
  37.     foreign key (idPessoaJuridica) references Pessoa(idPessoa)
  38. );
  39.  
  40. create table Dispositivos(
  41.     chaveDispositivo        int primary key not null,
  42.     tipodeDispositivo       varchar(255),
  43.     numerodeSerie       varchar(255),
  44.     modelodoDispositivo     varchar(255),
  45.     descricaodoDispositivo      varchar(255),
  46.     estadodoDispositivo     varchar(255),
  47.     localArmazenado     varchar(255)
  48. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement