Three valued logic
It
is a manyvalued logic system. It is proposed to handle NULL values. For example, consider a condition ‘Age > 15’. This condition
compares two values (one is stored in Age variable and the other is 15) and results
in either TRUE or FALSE (Boolean logic). What if one
of the operands is NULL? To handle
such comparisons the three valued logic has been proposed. Three
valued logic is sometimes called as Trivalent
logic, Ternary logic or Trinary logic.
"SQL’s
logic is an implementation of three valued logic".
Unlike
Bivalent logic system (Boolean logic
evaluates to TRUE or FALSE) there are three truth values
such as TRUE, FALSE, and UNKNOWN in three valued
logic system.
In
three valued logic system, the logical operators are evaluated as follows;
 NOT x – evaluates to 1 – x
 x OR y – evaluates to max(x, y), ie., whichever is true then the result is true
 x AND y – evaluates to min(x,y), ie., one of them is false then the result is false.
You
can observe the results from the following table;
x

y

x AND y

x OR y

NOT x

True

True

True

True

False

True

False

False

True


True

Unknown

Unknown

True


False

True

False

True

True

False

False

False

False


False

Unknown

False

Unknown


Unknown

True

Unknown

True

Unknown

Unknown

False

False

Unknown


Unknown

Unknown

Unknown

Unknown


*************
Three valued logic, the logic that evaluates to TRUE, FALSE, and UNKNOWN, How does SQL evaluates logic in its basic operations, SQL conditions and three valued logic, three valued logic, trivalent logic, ternary logic
No comments:
Post a Comment