March 22, 2012 at 1:29 pm
I have a requirement to store the address for an object in two separate tables -- one for State and one for City. There should also be a parent, child relationship between the two.
I am a little confused about what would be the best way to do this, and would appreciate any help that this forum can offer.
Should I just put the FK for City and State in the object's table and the FK for State in the City's, or am i going about this completely wrong? Thank you.
March 22, 2012 at 1:39 pm
is this for homework or an interview? kinda sounds more like homework
can you post the table DDL for the tables you are trying to match up? Please see the link in my signature for the proper forum etiquette on posting questions
For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]
Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
Jeff Moden's Cross tab and Pivots Part 1[/url]
Jeff Moden's Cross tab and Pivots Part 2[/url]
March 22, 2012 at 1:39 pm
rpnew (3/22/2012)
I have a requirement to store the address for an object in two separate tables -- one for State and one for City. There should also be a parent, child relationship between the two.I am a little confused about what would be the best way to do this, and would appreciate any help that this forum can offer.
Should I just put the FK for City and State in the object's table and the FK for State in the City's, or am i going about this completely wrong? Thank you.
i think what the requirement is stating is that your City Table needs to have a Foreign key to your State table;
the the application could alow them to select the city, and the State would follow automatically...
similarly a ZipCode table could have FK to tbcity(which links to County, which links to State), so that city,county,state are all selected based on the zip code, but that woudl require that county and state are not allowed to be null in the City table...
you'd have Springfield, CT, Springfield, Oh, Springfield , MA in there, as examples if you did the entire US cities.
Lowell
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply