TRUE
Example
Section titled “Example”SELECT TRUE;Output
Section titled “Output”1Explanation
Section titled “Explanation”In MySQL, TRUE is an expression which evaluates to 1.
Example
Section titled “Example”SELECT TRUE;Output
Section titled “Output”TRUEExplanation
Section titled “Explanation”The SQL command is selecting a Boolean constant value, which in this case is TRUE. The PostgreSQL database management system allows for the use of these types of Boolean constants. Upon execution, the command simply returns the Boolean value TRUE.
Example
Section titled “Example”SELECT (1 < 2) AS ComparisonResult;Output
Section titled “Output”| ComparisonResult ||----------------------|| TRUE |Explanation
Section titled “Explanation”The SQL code is comparing 1 and 2. Since 1 is less than 2, the output of the comparison is TRUE. The ‘AS’ keyword is used to assign an alias ‘ComparisonResult’ to the resulting value, making the output easier to understand.
Example
Section titled “Example”SELECT 1 FROM dual WHERE 2 > 1;Output
Section titled “Output”1Explanation
Section titled “Explanation”In this example, the query is returning the value 1 from the dual table where the condition 2 > 1 is true. As 2 > 1 is always true, the output will always be 1.