Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2012

    Problem in Designing Address Table

    Hello, I'm a beginner in database design.
    I've to design an Address table. I always design it as State(stateid) -> District(districtid) references State -> City(cityid) references District -> Address(addressid) references City.

    But now the problem is, I've to take up villages into consideration. Some people live in City and some in Village. So how to design this?
    I've taken two extra tables, Block(blockid) references District and Panchayat(panchayatid) references Block.

    But in Address table now I've to take two foreign key columns one which references City and one which references Panchayat. If there is a value in City column the Panchayat Column will be NULL and vice versa. This way I can see who live in village and who lives in city.

    Is this design correct or not? Or I should follow a different approach. Please help.

  2. #2
    Join Date
    Nov 2004
    out on a limb
    what you could do is somethign like

    table Area
    ID autonumber PK
    Description Char
    ParentArea FK references

    ID   Parent   Description 
    1     NULL  India
    98   1      Himchal Pradeesh
    23   98     Kullu
    3    98    Solan
    4    3     Solan
    65   3      Arki
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Mar 2012

    Thumbs up Thank You

    I've designed something like this before but haven't though this way on Address tables.
    Thank you for the help
    I'll also add an extra column Type which will describe whether its state, city, block, etc.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts