Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6808231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:55:48+00:00 2026-05-26T19:55:48+00:00

Basically the situation is like this (simplified, pseudo code): I have 2 TABLES person

  • 0

Basically the situation is like this (simplified, pseudo code):

I have 2 TABLES person and country.

Person table:

KEY INT ID, STRING NAME, STRING COUNTRY

Country table:

KEY INT ID, STRING COUNTRY_NAME

The client has control over what the contents are in the Country Table, so he can add and remove counties to the list. This country values appear in a drop down list when creating a person. When the person is created the country strings value is inserted in the country column of the Person row.

To me, it makes sense that that Person should have a foreign key reference to country, but because the client has control over what appears in the Country table, they are kept as separate tables, because you can’t just remove used countries, (referential integrity and all). This is an argument a colleague of mine made to not use foreign keys in this case, but I feel like there should be a better solution for this problem, So, is my colleague right or is there a better solution?

The client can add and remove values in the country table but if a value is removed from the country table, created person who used that value should keep their value.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T19:55:49+00:00Added an answer on May 26, 2026 at 7:55 pm

    Create an isactive column, the data for historical records will then show the county chosen orginally (or it’s updated value, see below) and the drop down list can be adjusted to only show the active countries. Under no circumstances should you remove the foreign key constraint. That is a recipe for data integrity issues.

    The setting to null idea is generally a bad one as well. You do not want to lose data about the country the person is in.

    If the country might change (as opposed to new countries being added), then you can use cascade update, but it is better in this case to use a surrogate key (which should not change). Then if the name is changed, it is reflected everywhere without having to update millions of child records.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The topic generically says it all. Basically in a situation like this: boost::scoped_array<int> p(new
In my code I have often situations like this: public void MyMethod(string data) {
i have this situation: print_r($key);echo'<br>'; foreach($value as $test){ print_r(count($test));echo'<br>'; } echo'<br>'; witch returns: Jerome
I'm pulling a content from PHP array and I have a situation like this:
Basically I have some code to check a specific directory to see if an
This is an extremely common situation, so I'm expecting a good solution. Basically we
So I keep having this small problem where I have something like func ::
I have a situation when there's a table and you can add a new
Here's my situation.. Suppose you have the following model entities, which represent single tables
The situation is this: I have a small 50x50 pic. I also have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.