Midnight Modding Posted June 8, 2018 Author Posted June 8, 2018 keep talking. https://stackoverflow.com/questions/9608639/mysql-comparison-with-null-value Quote In MySQL, NULL is considered as a 'missing, unknown value', as opposed to no value. Take a look at this MySQL Reference on NULL. Looks like "one" of us was using it incorrectly by thinking of it simply as nothing beyond nothing. In fact, it's even described exactly as I said, right at the BEGINNING of the article that linked to right on the mysql.com site. lol.
CodingJungle Posted June 8, 2018 Posted June 8, 2018 http://php.net/manual/en/language.types.null.php so you found a few wrong answers on stack overflow, congrats you can use google.
Midnight Modding Posted June 8, 2018 Author Posted June 8, 2018 Read again. On the official mysql site. Quote 3.3.4.6 Working with NULL Values The NULL value can be surprising until you get used to it. Conceptually, NULL means “a missing unknown value” and it is treated somewhat differently from other values. Come on, link your minions here to tell them how wrong I was and how right you were.
CodingJungle Posted June 8, 2018 Posted June 8, 2018 11 minutes ago, Midnight Modding said: Read again. On the official mysql site. Come on, link your minions here to tell them how wrong I was and how right you were. what have you proven exactly? that isn't what you originally said nor was it what you were trying to apply. CONCEPTUALLY you were saying null was "unknown" and that "nothing" was something else. so go ahead kid, continue rambling about things that are far beyond your ability.
Midnight Modding Posted June 8, 2018 Author Posted June 8, 2018 7 minutes ago, CodingJungle said: what have you proven exactly? that isn't what you originally said nor was it what you were trying to apply. CONCEPTUALLY you were saying null was "unknown" and that "nothing" was something else. so go ahead kid, continue rambling about things that are far beyond your ability. Predictable that you'd still be reaching when I proved myself correct. Exactly, I said CONCEPTUALLY many treat null as "unknown" and they treat an empty string as "known to be nothing". And that is exactly what that mysql.com quote says and backed me up on (after you just said 3 times it does not mean unknown). I said nothing about how it's treated in comparisons. if( $null ) will return false if $null is null. I never said otherwise. As usual, you're just wrong about what I know or don't know and don't like being wrong about it. Looks like it was actually beyond "your" ability as I was 100% correct. Then you started reaching by saying the links were wrong until I showed even mysql.com agreed. lol.
CodingJungle Posted June 8, 2018 Posted June 8, 2018 1 minute ago, Midnight Modding said: Predictable that you'd still be reaching when I proved myself correct. Exactly, I said CONCEPTUALLY many treat null as "unknown" and they treat an empty string as "known to be nothing". And that is exactly what that mysql.com quote says and backed me up on (after you just said 3 times it does not mean unknown). I said nothing about how it's treated in comparisons. if( $null ) will return false if $null is null. I never said otherwise. As usual, you're just wrong about what I know or don't know and don't like being wrong about it. SELECT * FROM mytable WHERE myfield='' SELECT * FROM mytable WHERE myfield IS NULL those will return two different results depending if that field is "empty" or if the value is "null". so if you insert a "empty" string to one record and a null value to another record on the same field, you will end up with different results on a select query. again, you are incorrect in your assumption that null simply means "unknown", their wording is "missing unknown value", php wording is "having no value", the two statements are identical in their meaning, that null isn't "unknown', but it simply "has no value". php and mysql both will treat null and empty as different, it says as much in the link you provided for mysql. so again, what exactly have your proven?
Midnight Modding Posted June 8, 2018 Author Posted June 8, 2018 5 minutes ago, CodingJungle said: SELECT * FROM mytable WHERE myfield='' SELECT * FROM mytable WHERE myfield IS NULL those will return two different results depending if that field is "empty" or if the value is "null". so if you insert a "empty" string to one record and a null value to another record on the same field, you will end up with different results on a select query. again, you are incorrect in your assumption that null simply means "unknown", their wording is "missing unknown value", php wording is "having no value", the two statements are identical in their meaning, that null isn't "unknown', but it simply "has no value". php and mysql both will treat null and empty as different, it says as much in the link you provided for mysql. so again, what exactly have your proven? Everyone can judge for themselves what I have proven by simply looking at what you kept telling me I was wrong about. I already know how they are treated. Stop changing the subject to try to save face. I said conceptually, why some allow null. I said nothing whatsoever to lead anyone to believe that null and an empty string are the same thing. In fact, I said totally opposite of that and you did your usual troublemaking attempt mocking me for being right. (I thought because you assumed, but it sounds like you didn't even know conceptually it meant unknown, either).
CodingJungle Posted June 8, 2018 Posted June 8, 2018 1 minute ago, Midnight Modding said: I said nothing whatsoever to lead anyone to believe that null and an empty string are the same thing 6 minutes ago, CodingJungle said: many treat null as "unknown" and they treat an empty string as "known to be nothing" keep telling yourself that, your definition for "empty" is the definition to null. they are not interchangeable, you can't pretend that null means "unknown" and empty means "known to be nothing", you are not right, you will never be right about this. you are the one that is trying to save face, i have been consistent, you have not. you keep trying to distract and change subject, from what you originally said, this is your god damn problem MM. this is why no one ever wants to help you, or give you advice, cause of this BS. i was using code examples to show that null was treated differently than empty in my original post, sure it wasn't what you were asking, but it was to show what i was talking about. so whatever man, no matter what i say, you will always be the victim. i hope you well in whatever you do. ? peace out!
Midnight Modding Posted June 8, 2018 Author Posted June 8, 2018 34 minutes ago, CodingJungle said: keep telling yourself that, your definition for "empty" is the definition to null. they are not interchangeable, you can't pretend that null means "unknown" and empty means "known to be nothing", you are not right, you will never be right about this. you are the one that is trying to save face, i have been consistent, you have not. you keep trying to distract and change subject, from what you originally said, this is your god damn problem MM. this is why no one ever wants to help you, or give you advice, cause of this BS. i was using code examples to show that null was treated differently than empty in my original post, sure it wasn't what you were asking, but it was to show what i was talking about. so whatever man, no matter what i say, you will always be the victim. i hope you well in whatever you do. ? peace out! Most ridiculous post yet. You literally just quoted where I said they aren't interchangeable, only to say I was wrong for saying they "are" interchangeable. I guess never is now, as I was right and showed it with the quote from mysql.com. Many people, conceptually, decide to allow null to signify that the field 's value is either unknown or missing, whereas they like using an empty string to signify that the value is a known nothing. That is the definition of not interchangeable uses, then you say I am the one saying they can be used interchangeably. All your example did was back me up. Why does it give different results for the query if the value is null vs. if it's an empty string? Because null and an empty string are not the same thing, as I said from the beginning. You can consider them the same if you want, in your php, but they are conceptually "supposed" to be used differently. You can use them for other reasons, but the intended use of null is exactly what I said, which you mocked: an unknown or missing value. treated as nothing because nothing is KNOWN, but it's not the same as a known nothing value, ie empty string. Yes, indeed you were consistently wrong. Four times you denied that null conceptually meant an unknown or missing value. I proved otherwise from mysql.com. I notice also you conveniently took the quote from the mysql site out of your quote of me, because it said exactly what you kept denying.
Midnight Modding Posted June 9, 2018 Author Posted June 9, 2018 edited to shorten this: Just curious why first party apps have almost all varchar fields allowing null. It makes me feel like I need to do it too, to stay consistent and be able to default form fields to null without an issue, but most people say it's best to not set one to allow null if there is no reason to distinguish between null and an empty string for the given column. And i don't recall seeing many cases where there is such a situation with the first party varchars. I know in some situations, allowing null can improve performance... so maybe it's that or maybe they just prefer it for whatever reason. I just don't like doing it when there's no need for both null and empty strings to be allowed, personally. (again, it's not just me, I've seen some others with that view on using it)
Recommended Posts
Archived
This topic is now archived and is closed to further replies.