Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
i'm not familiar with that book.
But somehow familiar with the antiquated and fundamentally wrong way of education.
And that seems like one of these examples....
Eg. in Germany:
+49 - country code
234 - city code, Bochum
Xxxxxxx - telephone number
The telephone system had a hierarchical database.
Some of the examples in textbooks still stem from that era - at least that's the only _sane_ example I could come up with.
When you look up hierarchical databases it makes more sense, since the prefix is a leaf node.
The hierarchical database pattern was - as far as I can remember - internationally common, so it shouldn't be specific for Germany.
If anyone has sources for/against,I'd really like to hear them.
@IntrusionCM I'm not sure I understand what you said, but my point is that splitting area and country codes from the rest of the number is a sensible decision, because they have a meaning by themselves, but splitting the number itself in two just because there's a dash in the middle is stupid.
In the number 55 11 9784-8900, the number 55 has a standalone meaning, it's the country code; the number 11 has a standalone meaning, it's an area code; but 9784 has no meaning if it's not together with 8900, so why split it up?
My whole point is that this is a terrible example to give to a newbie, nothing to do with _how_ the book explains stuff (which is awful too, but that's a whole different discussion).
@neeno sorry a tad drunk.
Before rational databases were a thing (and probably before you and I were born) humans needed a system to store telephone numbers.
Binary trees? That's a hierarchical database, but with a few specialties and restrictions.
Look eg here.
Many educational books took over the examples of "hierarchical databases" to relational databases... I think.
I might be totally wrong.
But for my brain and psyche it's more soothing than saying "they didn't know what they we're doing and called it education".
When you look at a hierarchical structure a prefix makes sense. It's a leaf of a node.
And the suffix is the leaf node.
@IntrusionCM lol np
Oh okay, I get what you mean. But the thing is, why split the number into "prefix" and "suffix"? There's no reason to do that, even the names are misleading. A prefix is something that comes before another thing and a suffix is something that comes after another thing. Splitting the number in half and calling the first half a prefix and the second one a suffix makes no sense, they're not prefixes and suffixes to anything else, only to each other.
In this example I'm concerned with the meaning of the separation of 9784-8900 into two. Each half of the number don't have meanings only by themselves, the dash in the middle does not have a meaning, it's just to make it pretty. 9784-8900 is the same as 97848900, but prettier.
However, 55 11 9784-8900 is not the same as 551197848900. The spaces between 55, 11 and 9784-8900 have meaning: they separate what's a country code, what's an area code, and what's the number itself. Thus, they should be split into separate attributes since that might be useful for some queries.
There is a hierarchical structure here:
But 9784-8900 is not two pieces of data, they're just a single one with a symbol in the middle for readability.
You're completely right.
In a relational database it makes no sense.
Didn't want to confuse you.
That's the gist: the example is bogus because it stems from an different _era_ in history.
Many educational books used in schools are wild copy pasta slightly changed in dozen of years.
In a relational database, you _could_ Go down the teached theorical normalization way.
Fully functional dependency,....
+49% with a LIKE on a column consisting of normalized data and a single index will be better than 3 columns (49… 234... xxxxxx ) with a compound index.
The "practical" part in databases boils down to the fact that a database _must consist of_ normalized data - otherwise it becomes a shitfest.
Normalization is a tool ;) Not a fixed guideline