in reply to Re^5: DBI: passing undef as an argument
in thread DBI: passing undef as an argument
For example: what does an "NULL" means in the "salary" field? "This person is salaried but we do not know his exact salary" or "This person is unemployed and has no salary" or "This person is salaried and we know his salary but he did not allow us to store this infirmation in a public database as this info is considered private and confidential"?
I agree that this is definitely a case where a separate no_salary_reason column would be highly appropriate, but, even so, I would still go with a non-value (i.e., NULL) in the salary column itself rather than inserting a fictitious value which would then doom me to never again being able to say WHERE salary... without adding a AND not salary_value_is_fictitious.
And as for your example of the address and the ZIP-code, I can easily think of an application where the zip-code info is absolutely necessary for it to work (perhaps to calculate shipping costs?) and where a "NULL" would break the aplication. And yes, by its very definition we must know all relevant data. If you allow the user to proceed without having given all relevant data, then either your application is doing it wrong or you asked the user to provide irrelevant data (i.e. you asked him to provide data which you do not strictly need) and that is probably as bad.
Yes and no... The one detail you neglected is the question of when the data is relevant. Unless you're shipping a package immediately, you don't actually need the ZIP code right now. Even if you do have something to ship, I should be able to enter as much of the address as I know at the moment, email the recipient to get his ZIP code, wait a day or two for him to reply, and then have the package ship as soon as I get his email and enter the ZIP code. Allowing the user to proceed without entering all relevant data is not necessarily doing it wrong.
But that was just a side example which is even further OT than the discussion of whether NULL is a good or a bad thing...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: DBI: passing undef as an argument
by CountZero (Bishop) on Aug 10, 2009 at 20:51 UTC | |
by dsheroh (Monsignor) on Aug 11, 2009 at 10:28 UTC |