converter mer para o modelo relacional e popular tabelas ...adao/aula01bd3b2017f.pdf · fusÃo de...
TRANSCRIPT
![Page 1: Converter MER para o Modelo Relacional e Popular tabelas ...adao/AULA01BD3B2017F.pdf · FUSÃO DE TABELAS. RELACIONAMENTO 1:1 FUSÃO DE TABELAS Criar uma nova tabela onde a chave](https://reader030.vdocuments.mx/reader030/viewer/2022033119/5e15a4e26c6e73434473d90d/html5/thumbnails/1.jpg)
1
Converter MER para o
Modelo Relacional
e
Popular tabelas criadas
Adão de Melo Neto
![Page 2: Converter MER para o Modelo Relacional e Popular tabelas ...adao/AULA01BD3B2017F.pdf · FUSÃO DE TABELAS. RELACIONAMENTO 1:1 FUSÃO DE TABELAS Criar uma nova tabela onde a chave](https://reader030.vdocuments.mx/reader030/viewer/2022033119/5e15a4e26c6e73434473d90d/html5/thumbnails/2.jpg)
CONVERSÃO
MER PARA O RELACIONAL
2
![Page 3: Converter MER para o Modelo Relacional e Popular tabelas ...adao/AULA01BD3B2017F.pdf · FUSÃO DE TABELAS. RELACIONAMENTO 1:1 FUSÃO DE TABELAS Criar uma nova tabela onde a chave](https://reader030.vdocuments.mx/reader030/viewer/2022033119/5e15a4e26c6e73434473d90d/html5/thumbnails/3.jpg)
3
CONVERSÃO DE ENTIDADE
![Page 4: Converter MER para o Modelo Relacional e Popular tabelas ...adao/AULA01BD3B2017F.pdf · FUSÃO DE TABELAS. RELACIONAMENTO 1:1 FUSÃO DE TABELAS Criar uma nova tabela onde a chave](https://reader030.vdocuments.mx/reader030/viewer/2022033119/5e15a4e26c6e73434473d90d/html5/thumbnails/4.jpg)
CONVERSÃO DE RELACIONAMENTOS
RELACIONAMENTO N:N CRIAR TABELA PRÓPRIA PARA RELACIONAMENTO
RELACIONAMENTO 1:N CRIAÇÃO DE COLUNA(S) ADICIONAL(IS) EM TABELA
RELACIONAMENTO 1:1 FUSÃO DE TABELAS
RELACIONAMENTO TERNÁRIO
GENERALIZAÇÃO/ESPECIALIZAÇÃO
AUTORELACIONAMENTO
GENERALIZAÇÃO/ESPECIALIZAÇÃO
![Page 5: Converter MER para o Modelo Relacional e Popular tabelas ...adao/AULA01BD3B2017F.pdf · FUSÃO DE TABELAS. RELACIONAMENTO 1:1 FUSÃO DE TABELAS Criar uma nova tabela onde a chave](https://reader030.vdocuments.mx/reader030/viewer/2022033119/5e15a4e26c6e73434473d90d/html5/thumbnails/5.jpg)
5
Regra PráticaRELACIONAMENTO N:NCRIAÇÃO DE TABELA PRÓPRIA PARA O RELACIONAMENTO
![Page 6: Converter MER para o Modelo Relacional e Popular tabelas ...adao/AULA01BD3B2017F.pdf · FUSÃO DE TABELAS. RELACIONAMENTO 1:1 FUSÃO DE TABELAS Criar uma nova tabela onde a chave](https://reader030.vdocuments.mx/reader030/viewer/2022033119/5e15a4e26c6e73434473d90d/html5/thumbnails/6.jpg)
É criada uma TABELA para o Relacionamento contendo:
Colunas correspondentes aos identificadores das tabelas relacionadas (chaves estrangeiras)
Colunas correspondentes ao atributos do relacionamento (caso existam)
Chave Primária
É formada pela concatenação das colunas correspondentes aos identificadores das tabelas relacionadas (chaves estrangeiras)
RELACIONAMENTO N:NCRIAÇÃO DE TABELA PRÓPRIA PARA O RELACIONAMENTO
![Page 7: Converter MER para o Modelo Relacional e Popular tabelas ...adao/AULA01BD3B2017F.pdf · FUSÃO DE TABELAS. RELACIONAMENTO 1:1 FUSÃO DE TABELAS Criar uma nova tabela onde a chave](https://reader030.vdocuments.mx/reader030/viewer/2022033119/5e15a4e26c6e73434473d90d/html5/thumbnails/7.jpg)
RELACIONAMENTO N:NCRIAÇÃO DE TABELA PRÓPRIA PARA O RELACIONAMENTO
![Page 8: Converter MER para o Modelo Relacional e Popular tabelas ...adao/AULA01BD3B2017F.pdf · FUSÃO DE TABELAS. RELACIONAMENTO 1:1 FUSÃO DE TABELAS Criar uma nova tabela onde a chave](https://reader030.vdocuments.mx/reader030/viewer/2022033119/5e15a4e26c6e73434473d90d/html5/thumbnails/8.jpg)
8
Regra PráticaRELACIONAMENTO 1:NADIÇÃO DE COLUNA(S) ADICIONAL(IS) EM TABELA
![Page 9: Converter MER para o Modelo Relacional e Popular tabelas ...adao/AULA01BD3B2017F.pdf · FUSÃO DE TABELAS. RELACIONAMENTO 1:1 FUSÃO DE TABELAS Criar uma nova tabela onde a chave](https://reader030.vdocuments.mx/reader030/viewer/2022033119/5e15a4e26c6e73434473d90d/html5/thumbnails/9.jpg)
9
Entidade com cardinalidade máxima igual a 1 recebe:
Atributo identificador da Entidade Relacionada
Colunas correspondentes ao atributos do relacionamento
(caso existam)
RELACIONAMENTO 1:NADIÇÃO DE COLUNA(S) ADICIONAL(IS) EM TABELA
![Page 10: Converter MER para o Modelo Relacional e Popular tabelas ...adao/AULA01BD3B2017F.pdf · FUSÃO DE TABELAS. RELACIONAMENTO 1:1 FUSÃO DE TABELAS Criar uma nova tabela onde a chave](https://reader030.vdocuments.mx/reader030/viewer/2022033119/5e15a4e26c6e73434473d90d/html5/thumbnails/10.jpg)
RELACIONAMENTO 1:NADIÇÃO DE COLUNA(S) ADICIONAL(IS) EM TABELA
![Page 11: Converter MER para o Modelo Relacional e Popular tabelas ...adao/AULA01BD3B2017F.pdf · FUSÃO DE TABELAS. RELACIONAMENTO 1:1 FUSÃO DE TABELAS Criar uma nova tabela onde a chave](https://reader030.vdocuments.mx/reader030/viewer/2022033119/5e15a4e26c6e73434473d90d/html5/thumbnails/11.jpg)
11
RELACIONAMENTO 1:1FUSÃO DE TABELAS
![Page 12: Converter MER para o Modelo Relacional e Popular tabelas ...adao/AULA01BD3B2017F.pdf · FUSÃO DE TABELAS. RELACIONAMENTO 1:1 FUSÃO DE TABELAS Criar uma nova tabela onde a chave](https://reader030.vdocuments.mx/reader030/viewer/2022033119/5e15a4e26c6e73434473d90d/html5/thumbnails/12.jpg)
12
Todas colunas de uma tabela são movidas para outra tabela
A tabela que cedeu colunas deixa de existir
Colunas correspondentes aos atributos do relacionamento são movidos para tabela resultante
Chave primária desta tabela permanece inalterada
RELACIONAMENTO 1:1FUSÃO DE TABELAS
![Page 13: Converter MER para o Modelo Relacional e Popular tabelas ...adao/AULA01BD3B2017F.pdf · FUSÃO DE TABELAS. RELACIONAMENTO 1:1 FUSÃO DE TABELAS Criar uma nova tabela onde a chave](https://reader030.vdocuments.mx/reader030/viewer/2022033119/5e15a4e26c6e73434473d90d/html5/thumbnails/13.jpg)
RELACIONAMENTO 1:1FUSÃO DE TABELAS
![Page 14: Converter MER para o Modelo Relacional e Popular tabelas ...adao/AULA01BD3B2017F.pdf · FUSÃO DE TABELAS. RELACIONAMENTO 1:1 FUSÃO DE TABELAS Criar uma nova tabela onde a chave](https://reader030.vdocuments.mx/reader030/viewer/2022033119/5e15a4e26c6e73434473d90d/html5/thumbnails/14.jpg)
Criar uma nova tabela onde a chave primária consiste na concatenação
das chaves primárias das outras entidades e que tenha como atributo os
atributos dos relacionamentos (caso existam)
Instituições (Sigla) Projetos (Número)Pesquisadores (CPF)Pesquisa (Sigla, Número,CPF, DataInício)
RELACIONAMENTO TERNÁRIOCRIAÇÃO DE TABELA PRÓPRIA PARA O RELACIONAMENTO
![Page 15: Converter MER para o Modelo Relacional e Popular tabelas ...adao/AULA01BD3B2017F.pdf · FUSÃO DE TABELAS. RELACIONAMENTO 1:1 FUSÃO DE TABELAS Criar uma nova tabela onde a chave](https://reader030.vdocuments.mx/reader030/viewer/2022033119/5e15a4e26c6e73434473d90d/html5/thumbnails/15.jpg)
![Page 16: Converter MER para o Modelo Relacional e Popular tabelas ...adao/AULA01BD3B2017F.pdf · FUSÃO DE TABELAS. RELACIONAMENTO 1:1 FUSÃO DE TABELAS Criar uma nova tabela onde a chave](https://reader030.vdocuments.mx/reader030/viewer/2022033119/5e15a4e26c6e73434473d90d/html5/thumbnails/16.jpg)
16
CONVERSÃO DE UM AUTO-RELACIONAMENTO
(adição de coluna)
![Page 17: Converter MER para o Modelo Relacional e Popular tabelas ...adao/AULA01BD3B2017F.pdf · FUSÃO DE TABELAS. RELACIONAMENTO 1:1 FUSÃO DE TABELAS Criar uma nova tabela onde a chave](https://reader030.vdocuments.mx/reader030/viewer/2022033119/5e15a4e26c6e73434473d90d/html5/thumbnails/17.jpg)
Criar uma Tabela única adicionando também um campo
denominado tipo (caso não exista)
SERVIDORES (CPF, Nome, Tipo, Função, Titulação, Categoria)
GENERALIZAÇÃO/ESPECIALIZAÇÃO
![Page 18: Converter MER para o Modelo Relacional e Popular tabelas ...adao/AULA01BD3B2017F.pdf · FUSÃO DE TABELAS. RELACIONAMENTO 1:1 FUSÃO DE TABELAS Criar uma nova tabela onde a chave](https://reader030.vdocuments.mx/reader030/viewer/2022033119/5e15a4e26c6e73434473d90d/html5/thumbnails/18.jpg)
18
AGREGAÇÃO
![Page 19: Converter MER para o Modelo Relacional e Popular tabelas ...adao/AULA01BD3B2017F.pdf · FUSÃO DE TABELAS. RELACIONAMENTO 1:1 FUSÃO DE TABELAS Criar uma nova tabela onde a chave](https://reader030.vdocuments.mx/reader030/viewer/2022033119/5e15a4e26c6e73434473d90d/html5/thumbnails/19.jpg)
![Page 20: Converter MER para o Modelo Relacional e Popular tabelas ...adao/AULA01BD3B2017F.pdf · FUSÃO DE TABELAS. RELACIONAMENTO 1:1 FUSÃO DE TABELAS Criar uma nova tabela onde a chave](https://reader030.vdocuments.mx/reader030/viewer/2022033119/5e15a4e26c6e73434473d90d/html5/thumbnails/20.jpg)
FAÇA CONVERSÃO E POPULE AS TABELAS
RESULTADO FINAL da CONVERSÃO
![Page 21: Converter MER para o Modelo Relacional e Popular tabelas ...adao/AULA01BD3B2017F.pdf · FUSÃO DE TABELAS. RELACIONAMENTO 1:1 FUSÃO DE TABELAS Criar uma nova tabela onde a chave](https://reader030.vdocuments.mx/reader030/viewer/2022033119/5e15a4e26c6e73434473d90d/html5/thumbnails/21.jpg)
PASSO 01 – CONVERTER ENTIDADES EM TABELAS
1) MÉDICOS (CRM, SALARIO, NOME, ESPECIALIDADE)
2) PACIENTES (CPF, NOME, TELEFONE, ENDEREÇO, RG)
3) QUARTOS (NÚMERO, ANDAR)
![Page 22: Converter MER para o Modelo Relacional e Popular tabelas ...adao/AULA01BD3B2017F.pdf · FUSÃO DE TABELAS. RELACIONAMENTO 1:1 FUSÃO DE TABELAS Criar uma nova tabela onde a chave](https://reader030.vdocuments.mx/reader030/viewer/2022033119/5e15a4e26c6e73434473d90d/html5/thumbnails/22.jpg)
![Page 23: Converter MER para o Modelo Relacional e Popular tabelas ...adao/AULA01BD3B2017F.pdf · FUSÃO DE TABELAS. RELACIONAMENTO 1:1 FUSÃO DE TABELAS Criar uma nova tabela onde a chave](https://reader030.vdocuments.mx/reader030/viewer/2022033119/5e15a4e26c6e73434473d90d/html5/thumbnails/23.jpg)
RESULTADO FINAL
![Page 24: Converter MER para o Modelo Relacional e Popular tabelas ...adao/AULA01BD3B2017F.pdf · FUSÃO DE TABELAS. RELACIONAMENTO 1:1 FUSÃO DE TABELAS Criar uma nova tabela onde a chave](https://reader030.vdocuments.mx/reader030/viewer/2022033119/5e15a4e26c6e73434473d90d/html5/thumbnails/24.jpg)