0
I have three tables:
- Candidate who has an ID as pk (which has been invented)
- Registration that has FK for Candidate
- ENEM that has no id representing the candidate, only his registration and information as color/ race, municipality
I need to bring this Pk_candidate in the table Registration making a JOIN with the table Enem, but how to do it if Candidate and Enem are not directly related by a unique code, only by information that repeat as sex?
I tried to relate Candidate and Enem by another table that both have in common, that would be Municipality, but also did not get the expected result, that would be the number of registration without repetition followed by the desired data.
The tables must be related in some way. What is the relational model of the database? Has ERI?
– Renato Junior
Has a MER that is in db designer (I can only share by email). The only table that would relate the two would be the Municipality, because the table Enem has cod_municipio and the Candidate has FK for municipality. Apart from this table, they have data in common, but that repeats between records...
– Miu in Wonderland
You should then make an Inner Join with the three tables then.
– Renato Junior
http://firebase.com.br/pipermail/lista_firebase.com.br/2004-December/004057.html I believe that Join implicito solves candidate->incricao--->Enem
– Motta
@RORSCHACH So I’m trying to do a JOIN between these three tables.. but the point is I need the candidate’s pk to fill the Registration table.. But this pk is an invented datum.. There is no table in ENEM or other, only in the candidate..
– Miu in Wonderland
Here is the schema done in dbdesigner -> http://i63.tinypic.com/2mmh9hc.png
– Miu in Wonderland
I’m starting to think there’s something wrong with modeling.. Just so you guys understand, the Eeven table is in a separate bank.. It is a "linguistics" of Enem data, containing the candidate data and the registration data.. But the pk_candidate is not there.. Only the registration number
– Miu in Wonderland
@Miuinwonderland So the DB was not well designed, you will have many problems
– Renato Junior
Thanks for the help, guys! I had to change the modeling and put the fk application inside candidate, no matter how wrong... It was the way I found to work. =/
– Miu in Wonderland