So why do many programs replace the main key of the database having a apparently random alternative id when revealing the record towards the user?

My prediction is it prevents customers from speculating other rows within the table. If that's the case, is not that simply false feeling of security?

I suppose you're speaking about surrogate secrets here. Among the preferred or supposed benefits of surrogate secrets is they aren't mired by any exterior meaning or reliance upon anything outdoors the database. So for instance the surrogate key values can securely be reassigned or even the key could be refactored or thrown away with no effects for customers from the system.

Generally surrogate secrets are stored hidden from customers to ensure that they do not acquire such exterior dependencies. Being hidden from customers was basically area of the original meaning of a surrogate key as suggested by E.F.Codd. If key values live in anyone's browser cache or favourites list they aren't much use as "surrogates" anymore. So that's one common reason you will notice one key used only within the database along with a different key for the similar table made visible within the application.

It may rely on the kind of application you're dealing with. Sometimes with Enterprise software that's an endeavor solely for the organization Sometimes for and isn't generally open to the outdoors world. Within this situation, it's frequently important to allow the user begin to see the surrogate key for individuals-related records since the information within the person table doesn't have originality. There might be two John Smiths (we really have over 1000 of these) who're truly differing people. They might even have a similar business address and become differing people (Sons are frequently named for fathers and operate in exactly the same medical practice for example). So they have to make reference to the surrogate key on forms as well as in confirming to be while using record they thought they wanted. OItherwise when they desired to research further particulars concerning the John Cruz they saw inside a report, wouldso would they appear up within the aaplication without needing to undergo all 1000 to obtain the correct one? Developing a fake id along with the real you might the perfect consuming (we import countless records at any given time) as well as for no real gain because the data wouldn't be visible outdoors our comapny application.

For any web application that's available to everyone, I can tell where you will possibly not wish to show these details.