![]() | |
#41
| |||
| |||
|
|
"Rok Debeljak" <rok.debeljak (AT) milenij (DOT) si.remove> wrote in message news:Ru2ld.5529$F6.1282471 (AT) news (DOT) siol.net... Here are the two times: 2004.11.11 24:00 2005.11.12 00:00 ... If a computation happened to result in 2004.11.11 24:00, I would want it to convert it to 2005.11.12 00:00. And I would call this final step One year up or down does not really make any difference for a comparator that really understands what we are talking about ;-) Rokson Ouch!!!! Of all the typos I've ever made, this is the worst. I don't know how I missed it. My proofreading skills are going down the drain! Let me try the whole thing over again, corrected: According to ISO, we can assign the value 0000 or 2400 to midnight. Let's look at another time, say 2 PM, or 1400 . Do we assign two values to 1400? Believe it or not, this is a problem in "normalization". Not "data normalization" as we ordinarily speak of it in database discussions, but normalization nonetheless. Let's say that we are given two times, and asked whether they are equal or not. Here are the two times: 2004.11.11 24:00 2004.11.12 00:00 The above form is for illustration purposes only. Now a naive comparator would answer the question "no". But a comparator that really understands what we are talking about might take a closer look, and come up with the answer: "yes". I like the answer "yes", myself, better. In fact, I would like the "time type engine" whenever it's done some calculation on time, (like adding an "interval" to a "base time") to perform one final step, before delivering the result to the outside world. If a computation happened to result in 2004.11.11 24:00, I would want it to convert it to 2004.11.12 00:00. And I would call this final step "normalizing the result". Once the results of a computation have been "normalized" , a naive comparator can test for equality by just comparing the representations. Right? Actually, IMO, this makes a strong argument for storing times |
#42
| |||
| |||
|
|
I was considering a type (-engine?) as "DATETIME". An attribute of this type holds values that may be represented in various ways, but the VALUE doesn't depend on HOW it is represented to "the outside world" (and neither should a comparator on that type). Just nit-picking again <g>. (For reference and to educate myself: where can I find your term "type engine" defined as you use it?) |
#43
| |||
| |||
|
|
"Ja Lar" <ingen (AT) mail (DOT) her> wrote in message news:4194ed13$0$245$edfadb0f (AT) dread11 (DOT) news.tele.dk... I was considering a type (-engine?) as "DATETIME". An attribute of this type holds values that may be represented in various ways, but the VALUE doesn't depend on HOW it is represented to "the outside world" (and neither should a comparator on that type). Just nit-picking again <g>. (For reference and to educate myself: where can I find your term "type engine" defined as you use it?) I don't have a formal definition. I was just picking up on the term as I saw it used in this newsgroup. But maybe this will help: when I tried to distinguish between the "naive comparator" and the "intelligent comparator" my point was precisely that the naive comparator compares representations, while the intelligent comparator compares values. Maybe "aware comparator" would have been better than "intelligent comparator" Thus the question 2004.11.11.24.00 =? 2004.11.12.00.00 is "no" when you compare the representations, but "yes" when you compare the values. This is why engines that allow user defined datatypes require the definer to supply the comparator. I don't think this is very educative, and there's probably a better way to say it. But this is the best I can come up with. Ideally, there is a 1 for 1 homomorphism between representations and values. When it isn't 1 for 1 it behooves us to normalize, if a given value has more than one representation, and it really behooves us to disambiguate if a single representation stands for more than one value. Does this settle the matter? I think I understand what you mean, and from a practical view I can follow |
#44
| |||
| |||
|
|
In RM's current solution, symbol and town name are the same thing resulting in inflexiblity in above case. In XDb2's solutions a symbol or string names a town which is a different thing than the symbol or string. RM has its own advantages which I did not list here. What you are not realizing is that "town" would never be a Primary Key, so it is easy in the RM to have more than one town with the same name. No big deal. |
#45
| |||
| |||
|
|
Then the question reduces itself as to how to represent the instance of time which is "midnight" - 2400 hours or 0000 hours? NPL |
#46
| |||
| |||
|
|
Nick Landsberg wrote: Then the question reduces itself as to how to represent the instance of time which is "midnight" - 2400 hours or 0000 hours? NPL I've heard people say "twenty-four hundred hours." I've never heard anyone say "zero hundred hours." Maybe 00:00 is "midnight am," and 24:00 is "midnight pm." |
#47
| |||
| |||
|
|
In RM's current solution, symbol and town name are the same thing resulting in inflexiblity in above case. In XDb2's solutions a symbol or string names a town which is a different thing than the symbol or string. RM has its own advantages which I did not list here. What you are not realizing is that "town" would never be a Primary Key, so it is easy in the RM to have more than one town with the same name. No big deal. True in general, but not when using the one-table schema provided by Mr. Celko. Please show how the current RM solution can work if two towns are named the same (ie change name of town c to a). |
#48
| |||
| |||
|
#49
| |||
| |||
|
|
In RM's current solution, symbol and town name are the same thing resulting in inflexiblity in above case. In XDb2's solutions a symbol or string names a town which is a different thing than the symbol... What you are not realizing is that "town" would never be a Primary Key, so it is easy in the RM to have more than one town with the same name. True in general, but not when using the one-table schema provided by Mr. Celko. Please show how the current RM solution can work if two towns are named the same (ie change name of town c to a). town PK state PK main_postal_code PK start_date end_date |
|
Philadelphia PA 19104 6/1/1682 11/12/2004 Neodelphia PA 19104 11/12/2004 12/31/2999 And, no - storing PA twice is not redundant. |
#50
| |||
| |||
|
|
Philadelphia PA 19104 6/1/1682 11/12/2004 Neodelphia PA 19104 11/12/2004 12/31/2999 And, no - storing PA twice is not redundant. Storing any thing (ie PA) twice is redundant. |
|
On way to prove redundancy is to change the second PA and see if data is corrupted (without triggers/code to synchronize them). |
|
Also, if a property is added to PA, will you add it the first PA, second PA, or both? |
![]() |
| Thread Tools | |
| Display Modes | |
| |