- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Actually, it's "left as an excercise to the reader to figure out which posts I'm responding to."
Admin
To me: division by zero = NaN. an error. Which is different than NULL. But could equate to zero, based on context. Which might equate to False, Not Specified, Other, or Unknown or anything else that resolves numerically to an insignificant value within the context of a number.
That said, it's still not NULL. NULL is a test for existence, not numeric value.
Admin
what happens when you want a positive or negative null?
Admin
LOL...then you'd have a NULL tendency.
Admin
I thought that was "There 11 kinds of people in the world, those that know how to count in binary and those that don't."
No, No, No
It's:
There are 10 types of people in the world: those that know how to count in binary, those that don't, and those that know real gurus start counting at 0.
Admin
Erm, it can be unknown, can it? I guess the data comes from a multiple choice form, with two checkboxes indicating whether it is a tps_reportable...
Admin
There's another type of person you forgot about:
Admin
You want them to BREED??? Are you out of your f*ing MIND?????
Admin
Actually, it's not as silly as you think. I agree with you that NULL should be NULL, but the people over at Oracle do not. I figure their design team had a whole bunch of open cans of paint laying around when they though that one up. Anyways, if they guy wanted his code to work on Oracle, or a database that does that, then having a separate value for NULL might make sense.
Admin
No, 0 is NUL in ASCII. NUL is not the same as NULL.
Admin
Sure ;)
NULL is a well-defined value meaning a lack of value.
Not Specified means something has not yet been specified resulting in a lack of value.
Unknown means the value is unknown at this time and by so lacking.
Admin
What do you mean? The implicit "primary key is not null" constraint in Oracle?
Admin
<FONT face=Arial size=2><FONT face=Arial size=2>
The real WTF was that the data was trashed because the FK constraint was not in place so there is no integrity, which means I could never be sure if I was getting the correct results to the right question. It looked like that, as the applications using this data progressed over the years different developers had different thoughts on how to deal with 'missing' or unknown values, and never went back and fixed the data up to comply with their new way of dealing with the two extra states. Hence the -1 values found and the weird values in the lookup table. I'm guessing that several other apps which used this same database also had their own unique way of dealing with the same problem, thus the seemingly duplicate logic.
The secondary WTF and a very common one, is that the TPS_Reportable attribute was nullable.. nulls are just a WTF in general TBH, as they do not comply with the relational model (which is based on 2 values logic, not 3), and tables with nullable attributes don't meet 1NF. SQL Standards say that Null is not a value, but a flag to indicate that the value is unknown, 1NF says that all values for a given attribute must be of the same type. Null is not a value (as indicated by the SQL standards), and even if it was it would not be of the same type as the attribute (Null is not an integer, char or anything else)
My only thoughts with the weird lookup table was at some point someone decided that they wanted to be able tell the difference between unknown value. unspecified and not applicable (I believe Codd has a few proposals for the relational model many years back for 3, 4 valued logic, but he rejected them himself and C.Date has since always specified that the relational model deals only with 2vl). The unknown, not applicable problem can simply be got around with a good logical design.
As it turned out, if the TPS_Reportable was 'yes', then a series of other fields were also populated (about 10). so if the case was TPS_Reportable, then it wasn't just a plain old 'case' but a TPSReportableCase, and should have been 'promoted' to it's own table, with a 1...0 constraint back to the Case table.
This would have then made the query really simple, just select all tuples / rows from the ReportableTPSCase and join back onto the case table to get any necessary attributes.
</FONT>ohh well, for the record this was not a goverment agency, but a financial one...After three weeks I vanished.
</FONT>Admin
Fact has it quotes work in Firefox, for I do use Firefox and quotes do usually work for me (Murphy's Law will probably bork that one though, just to prove me wrong)
Admin
<FONT face=Arial size=2>Depends on which app the user is using. Some apps it is a button, others display the full list of possible values from the lookup table, others displayed Yes, No...</FONT>
<FONT face=Arial size=2>I found that all the applications populated the field with diffrent values, (somce had hardcoded values... eg tps_reportable = 1, others used the values in the lookup table..)</FONT>
<FONT face=Arial size=2>Also, if no was selected, the status of the Case was not backtracked, so if you used the status field for any reporting it would still yell you it had been submitted to the TPS organisation, and the remaining tps_reportable fields were not wiped (eg, the TPS contact etc)</FONT>
Admin
2 to the power of what equals 0?
Admin
That was the first thing I thought when I started reading this one.
For some reason this one reminds me of "2+2=5 for very large values of 2"
Admin
Why, minus infinity of course :)
A fine number, with very few drawbacks.
Then again, if we're being that loose, 10 is also a power of 2. Though this has the ability to be true for integral powers for some bases.
darj
Admin
You all do realize that the table TN_Lookups is a foreign key for many different tables, not just the cases given here. Paul just hadn't has time in the contract to look at the rest of the schema to see them.
At one time I was naive enough to believe the above statement can only be made as a joke. I'm now convinced that it is fully correct, even though I have never worked there.
Admin
You can find the limit of 2^-X as X approaches INFINITY but I don't think that you could say that 2^-INFINITY = 0.
Admin
I know
null is sorta
Admin
dsadas
Admin
I've worked as a DBA for long enough to have seen every conceivable bit of crap, but I'm not sure this one IS crap. Had one guy call me up screaming because a lookup table I'd made had a zillion duplicate values...I suppose he'd have liked it better if I'd had a different lookup table for every tiny dataset I needed to use in a comparison or dropbox. If he'd taken the time to actually look at the table, he'd have noticed that they were all arranged in distinct sets, so that while "SELECT DISTINCT value FROM tlookup" would give a ton of garbage, "SELECT * FROM tlookup ORDER BY group_id" would give a long list of intelligent, discrete, lists. If he'd wanted a particular one, all he had to do was use the group_id to get the list he needed.
In my experience, this is the most common way to deal with a lookup table in a large project...It's a little more time consuming to pull your data from the lookup table, but the convenience of always knowing which table to pull FROM makes up for it.
I'd want to see the actual data on this one. It could be that the programmer is just assuming that the lookup table is only being used for one purpose when it's being used for several, and a better formed query would give a more rational dataset.
Admin
Yes, the byte is different, but only by one bit:
NULL = 0x00 (0 decimal) or 00000000
Space = 0x20 (32 decimal) or 00100000
This holds for most modern systems using a 7- or 8- bit character set, but is an arbitrary convention.
01001001 01101110 01110010 01100011 01101000 01100001 01101110 01110100 01100101 01110010
Admin
<FONT face=Arial size=2>no, really.. it is crap. for many reason.</FONT>
<FONT size=2><FONT face=Arial>The text field in the lookup table is just that a field displayed to the user and is thus changeable (say for example, the marketing people don't like 'yes' and 'no' and want 'true', 'false' or 'affirmative', 'negative'. The Id attribute is an integer and auto generated and so cannot be relied upon. </FONT></FONT>
<FONT size=2><FONT face=Arial>Secondly, the Id attribute on the lookup relation is meaningless and should not exist, and it forces a pointless join. If there was a 'lookup code' field on the table, which was the PK, which held values such as TRUE, FALSE, UKNOWN, UNSPECIFIED then selecting all reportable cases would be just a case of saying where field='TRUE', and not having to a pointless join on a meaningless key .. (Surrogate keys seem to be another common and accepted WTF for some reason).</FONT></FONT>
<FONT face=Arial size=2>Lookups tables are a general WTF in database design, as the model looses meaning and clarity because we loose the semantics of the field having a specific user defined domain (type). If the attribute TPS_REPORTABLE was defined as domain BOOL for example, and BOOL was defined as a domain, with a pool of values constrained to Yes and No, then we bring clarity and meaning to the model. </FONT>
<FONT face=Arial size=2>As tps_reportable was an FK(not enforced) to a general lookup table, what we are saying is that the allowable values for tps_reportable can be anything from 'yes', 'no' to File Not Found and any other value found in the lookup table. </FONT>
<FONT face=Arial size=2>Lookup tables break 1NF because what you are saying is that values from different domains are stored against the same 'generic' type are and can only be distinguished by looking at another attribute called 'group_id' </FONT>
Admin
> You can find the limit of 2^-X as X approaches INFINITY but I don't think that you could say that 2^-INFINITY = 0.
No i'm pretty sure that 2^-INFINITY = 0 for very large values of INFINITY
Admin
You haven't worked on many projects with trash databases like this one, have you? While you're answer may be the correct one, you really don't know since the contstraint has obviously not been enforced and they obviously aren't using the defined values. There is a good chance that there are other values in the column that also mean 'yes' or that 1 doesn't mean 'yes' at all. To further complicate things, the meaning of the column could depend upon any number of things like other columns in the table, when it was entered, what office it was entered by, or what person entered it. Depending upon what the values in the column actually mean, a problem like this can get quite complicated. Depending upon the number of records one is dealing with, and the amount of non-uniformity in what the values mean, the programmer could spend hours or days just trying to determine what the customer means by a case being 'TPS Reportable.'
Although this problem may be as trivial as you say, don't underestimate its potential to create chaos. Besides, the values defined in their code table is a WTF in and of its self.
Admin
Other than the nullability, this is an excellent design. Evidently, determining whether the case is reportable is very important to this organization. Report the information and call it a day.
Admin
No, I included them:
Admin
Wow, I'm sure the seasoned professional wasn't aware he could use multiple SELECT statements.... I think you're missing the wtf -
A) Is_TPS_Reportable is an unconstrained foreign key
B) Is_X is usually indicative of a boolean... or at worst, a boolean column which allows NULL.
C) 6 values does not a boolean make.
Admin
hehe, just as i had lost all hope in this thread - something that made me actually laugh.!! good one!
Admin
Um. Yeah. Well, I'm going to have to go ahead and forward you a copy of that memo.
Admin
Initech has had this problem for some time - as we all know. The only way to solve this, is to work the weekend.
Admin
He probably meant null as in 0 (zero)
Eks:
00110000 compared to
00100000
Admin
But some of the "unknown" rows might actually be "Yes"--the person who keyed it in just wasn't sure and set it to unknown. So it need to take all the rows where the value is Yes, plus a random selection of the unknown rows.
Admin
I only said that the value is in fact known by some mortal agency. It is not specified for, oddly enough, unspecified reasons. One of those reasons is possibly that the user making the query would not comprehend the answer they clearly seek.
I do, however, agree with your suggestion that a new table of reasons needs to be added along with a foriegn, or possibly even domestic (given national security and all), key by which the unspecified "not specified" reason can be specified in greater detail.
Admin
>> coincidentally, "Null" is the German word for Zero. <<
No, it's no coincident. "NULL" reads "NULL" _because_ Null is the german word for zero.
And to the NULL != NULL thingy -- that makes perfect sense. Of course it doesn't apply everywhere, but that again makes perfect sense. After all you wouldn't want NULL != NULL for DISTINCT or IN...
Admin
Wow thank god, I thought somebody totally missed the office space hints on here.. LoL !
Admin
Admin
I like how you have to specify a value when you want to say "not specified".