• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Database Normalization Question

Page 2 - Seeking answers? Join the AnandTech community: where nearly half-a-million members share solutions and discuss the latest tech.
Status
Not open for further replies.
Did you even READ the ISO and W3 standards which AREN'T the wikipedia?

Our argument isn't over wether it will work or not. It is over saying NULL is 0. Context has NOTHING to do with it, they aren't the same. I've proved my point well enough.

Yes, links to irrelevant pages yet we're talking about MySQL here and for all intents and purposes, NULL is 0 since both = FALSE...and using 0 as the top level parent_id is not incorrect.

If you cannot provide an example where using 0 to indicate the top-level parent_id would somehow cause the application to function incorrectly (and you cannot because it will work just fine), you have nothing else to say.
 
Yes, links to irrelevant pages yet we're talking about MySQL here and for all intents and purposes, NULL is 0 since both = FALSE...and using 0 as the top level parent_id is not incorrect.

If you cannot provide an example where using 0 to indicate the top-level parent_id would somehow cause the application to function incorrectly (and you cannot because it will work just fine), you have nothing else to say.
Select * from table where parent_id IS NULL;

Gee, that wont work if parent_id is 0.
 
Null and zero are interchangeable here, and the more you try to say otherwise the more you look like bumbling fools.

I find it interesting that your position has morphed from "NULL = 0, broski" to "Null and zero are interchangeable here." I can make any application work with either method, that has never been the question. You jumped down another poster's throat in your typically rude manner for emphasizing that null != 0 in good db design, and you were wrong about that. Again, in typical fashion you continue to pursue your point with bombast and ad hominem attacks. At this point I have nothing further to add to this, and it's quite apparent you do not either. If you persist in acting like an ass I will lock the thread with apologies to OP, and he can post the question again if it still needs further explanation.
 
Select * from table where parent_id IS NULL;

Gee, that wont work if parent_id is 0.

Yes, and that is a good reason not to use NULL for the top level parent_id. Using zero lets you be consistent in the app design as well as the structure of the data within the database.

I find it interesting that your position has morphed from "NULL = 0, broski" to "Null and zero are interchangeable here." I can make any application work with either method, that has never been the question. You jumped down another poster's throat in your typically rude manner for emphasizing that null != 0 in good db design, and you were wrong about that. Again, in typical fashion you continue to pursue your point with bombast and ad hominem attacks. At this point I have nothing further to add to this, and it's quite apparent you do not either. If you persist in acting like an ass I will lock the thread with apologies to OP, and he can post the question again if it still needs further explanation.

No, I did not "morph" my position. I stand by my original statement that, in this context, null is zero...which it is...since they both evaluate to "false" and they ARE NOT representing a quantity of anything, they are both equal in this regard. What you and Cogman did was drive the topic off course into an irrelevant tangent of NULL not being equal to 0 in some other context, i.e. C programming. Even then, you can use NULL or ZERO and it has been like that with large projects like the linux kernel.

You have already demonstrated that you are not one to talk to about good anything design, as you spend more time worrying about aesthetics than you do about functionality and simplicity. If I didn't know any better I'd say you spend a lot of time with McProgrammer languages that remove the element of skill from the equation.

It's nice that you can lock the thread when you don't want to concede to people who are right, when you are wrong...maybe you should do that to stop yourself from embarrassing yourself any further.
 
Yes, and that is a good reason not to use NULL for the top level parent_id. Using zero lets you be consistent in the app design as well as the structure of the data within the database.



No, I did not "morph" my position. I stand by my original statement that, in this context, null is zero...which it is...since they both evaluate to "false" and they ARE NOT representing a quantity of anything, they are both equal in this regard. What you and Cogman did was drive the topic off course into an irrelevant tangent of NULL not being equal to 0 in some other context, i.e. C programming. Even then, you can use NULL or ZERO and it has been like that with large projects like the linux kernel.

You have already demonstrated that you are not one to talk to about good anything design, as you spend more time worrying about aesthetics than you do about functionality and simplicity. If I didn't know any better I'd say you spend a lot of time with McProgrammer languages that remove the element of skill from the equation.

It's nice that you can lock the thread when you don't want to concede to people who are right, when you are wrong...maybe you should do that to stop yourself from embarrassing yourself any further.
You are seriously an idiot.

There is nothing more to add. We have directly quoted your contradiction, and anyone that reads this thread can see the steady progression of your changing view just so you can be "right".

Null and zero don't both evaluate out to false. It is entirely possible for the OP to make a 0 key in his table. And as has been pointed out, NULL and 0 don't behave the same in this context.

Have a nice day.
 
Last edited:
You are seriously an idiot.

There is nothing more to add. We have directly quoted your contradiction, and anyone that reads this thread can see the steady progression of your changing view just so you can be "right".

Null and zero don't both evaluate out to false. It is entirely possible for the OP to make a 0 key in his table. And as has been pointed out, NULL and 0 don't behave the same in this context.

Have a nice day.

My original statement, which you seem to have an issue with:

"Null is zero"

Why?

Null = False
0 = False
False = False
Null = 0 = False

if you use 0 or NULL...

parent_id == 0 OR parent_id == NULL OR parent_id == false (depending on which you use)

...it is the top level and therefore is not a sub category.

Everything you and the other guy said is irrelevant to the context of this thread, and just a feeble attempt at trying to seem smarter than you really are by linking to wikipedia or searching google to fill in the gaps of knowledge.

Facts which I originally stated, that are still true:
Using 0 to indicate the top level of a recursive tree is not incorrect, not bad coding and works 100% of the time.

What you could not do:
Demonstrate that using 0 to indicate the top level of a recursive tree is incorrect, bad coding or works less than 100% of the time.

What you attempted to do:
Obfuscate my original point by making irrelevant comparisons (and still failing to support your position) by completely ignoring the context of my statement.

Conclusion:
Your brain is NULL, broski.

Locked. My apologies to the OP for the way this thread turned out. Please repost if you still have unanswered questions.

Markbnj
Programming moderator
 
Last edited by a moderator:
Status
Not open for further replies.
Back
Top