Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Duvida Foreign Key
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Ralph Effting  
View profile   Translate to Translated (View Original)
 More options Sep 15 2012, 3:15 pm
From: Ralph Effting <ralft...@gmail.com>
Date: Sat, 15 Sep 2012 12:15:57 -0700 (PDT)
Local: Sat, Sep 15 2012 3:15 pm
Subject: Duvida Foreign Key

Boa tarde estou com uma duvida (de iniciante hehe), não intendo ainda muito
de sql, então vamos lá:
Tenho 2 tabelas, usuário e dados.

*Usuários*
nome
login
senha
*Dados*
endereço
telefone
profissao
...

Minha duvida é com relação como ficaria as chaves, colocaria a *FOREIGN KEY*na tabela
*usuários* ou na tabela *dados*?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brunno Henrique  
View profile   Translate to Translated (View Original)
 More options Sep 16 2012, 2:54 pm
From: Brunno Henrique <bhmo...@gmail.com>
Date: Sun, 16 Sep 2012 15:54:25 -0300
Local: Sun, Sep 16 2012 2:54 pm
Subject: Re: Duvida Foreign Key

vc colocaria o ID do usuário na tabela DADOS, vale lembrar que é de super
importante você criar uma tabela LOGADOURO, CIDADE, ESTADO onde você
colocaria o endereço, pois o usuário poderá ter 2 ou mais telefones, e
talves poderia ter duas profissões (sei la).

SELECT
    U.NOME,
    U.LOGIN,
    U.SENHA,
    D.ENDERECO,
    D.TELEFONE,
    D.PROFISSAO
FROM
    USUÁRIO U RIGHT JOIN DADOS D ON
                       (U.ID_USUARIO = D.ID_USUARIO)
ORDER BY 1,4;

se existisse a tabela logradouro, cidade e estado o select seria diferente;

Espero ter ajudado.

Em 15 de setembro de 2012 16:15, Ralph Effting <ralft...@gmail.com>escreveu:

--

Att.
*Brunno Henrique*
Administrador de Redes / Administração - T.i.
Msn / E-mail: bhmo...@gmail.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ralph Effting  
View profile   Translate to Translated (View Original)
 More options Sep 16 2012, 7:08 pm
From: Ralph Effting <ralft...@gmail.com>
Date: Sun, 16 Sep 2012 20:08:53 -0300
Local: Sun, Sep 16 2012 7:08 pm
Subject: Re: Duvida Foreign Key

Muito obrigado Bruno!
Tirou minha duvida.

Abraço.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »