I'm trying to build a database for personal use, and part of the db will store the data of addresses, and the way I have done it is this:
Table 1: Address (Line 1 & 2) -- foreign key ----> Postal Codes
Table 2: Postal Codes -- foreign key ----> Locality (ex: cities)
Table 3: Locality -- foreign key ----> Provenience
Table 4: Provenience -- foreign key ----> States
Table 5: State -- foreign key ----> Countries
Table 6: Countries
PS: Tables from 1 --> 6 have nested foreign keys
I would like to know how can I make a view resulting all the data in Table 1 with all the corresponding data in Tables 2-->6, without repeating common columns ???
Thank you every one I have just managed to solve it, and here is how I have done it, showing only the fields I want, with the rows I want with out duplication. (Pardon me, I´m a noob)
Start with the fields of the first table you want it on your left,
To make it simple for SQLite noods such as myself:
So what if you want more fields from more tables (included tables with nested fields ?
Just do as follows
I know that this solution could be seen as cumbersome, but its advantages are:
That is the way it solved itself with me, but I'm ready to hear better answers