Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 9 years, 10 months ago. Active 2 years, 5 months ago. Viewed k times. Improve this question. Community Bot 1 1 1 silver badge. Sachin Kainth Sachin Kainth Check out: w3schools. Add a comment.
Active Oldest Votes. This need for three-valued logic is a source of many application errors. These tables provide examples of this behavior. Skip to main content. This browser is no longer supported. Download Microsoft Edge More info. Nick that the NULL values in his spouse and status columns represent an unknown value. To maintain the integrity of a database, both interpretations of NULL are necessary. Binary logic uses two values: True and False, 0 and 1, etc.
Ternary logic uses three values. Interesting, but not something you need to memorize. As you will see, SQL helps us work around this tricky logic.
Which is handy, because SQL comparison operations use the same ternary logic. Whatever the comparison column contains — salaries, pet names, etc. This is true even if the column value is NULL. This is what confuses programmers who are experienced in other languages. So as our query is evaluated, it is going to look like this:. This comparison is also going to return unknown. We can see from the truth table earlier that NOT unknown is going to return unknown.
Report Error. Your message has been sent to W3Schools. W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning.
0コメント