Danish Habib

Danish Habib

  • NA
  • 694
  • 245.7k

Database Design

Apr 16 2015 1:51 AM

I have an application having  users in it , and these users are associated with different locations , the locations are cascade in nature mean that they are like State,country,City for example

I have District as location which  is the Top entity in location context so the table contains

DistrictUsers(Districtid(P),DistrictName,UserID(F))

Next table is Tehsil mean that the district contains tehsil on selection of district the Tehsils Will populates so the Tehsil table should have the forign key of District id in it so that

TehsilUsers(TehsilID(P),TehsilName,DistrictID(F),UserID(F))


Now The selection of tehsils the Village Come up so the VillageUser table must contain the tehsilID as forign key

so that

VillagesUsers(VillageID(P),VillageName,TehsilID(F),UserID(F))

and the main user table is

Users(Userid,(P),UserName)


P STAND FOR PRIMARY KEY AND F FOR FOREIGN KEY


Tell me this tructure is good enough if not then propose a table structure also let me know how to save that records in bulk insertion I am using that same structure but I am using TABLE VALUE PARAMETERS FOR INSERT FOR FIRST TWO TABLE It Work but when it reach the third it gets hanged and in loop, meanwhile locally it works fine but on server it gets too much slow


Relpy any one


Answers (2)