|
Home >> FAQs/Tutorials >> SQL Server FAQ
SQL Server FAQ - What Are Comparison Operations
By: FYIcenter.com
(Continued from previous topic...)
What Are Comparison Operations?
Comparison operations return Boolean values by comparing the relative positions of two operands.
SQL server supports the following comparison operations:
- = (Equal To): Returns Boolean true, if two operands are equal in value.
- > (Greater Than): Returns Boolean true, if the left operand has a value greater than the right operand.
- < (Less Than): Returns Boolean true, if the left operand has a value less than the right operand.
- >= (Greater Than or Equal To): Returns Boolean true, if the left operand has a value greater than or equal to the right operand.
- <= (Less Than or Equal To): Returns Boolean true, if the left operand has a value less than or equal to the right operand.
- <> (Not Equal To): Returns Boolean true, if two operands are not equal in value.
There are several rules you need to remember about comparison operations:
- Comparison operations can be performed on all data types: exact numbers, approximate numbers, character strings,
and binary strings.
- If two operands have different data types, the operand with a lower data type rank will be implicitly converted
to the data type of the other operand.
- Character string comparison will be performed based the rules defined in the associated collation.
(Continued on next topic...)
- What Is a Boolean Value?
- What Are Conditional Expressions?
- What Are Comparison Operations?
- How To Perform Comparison on Exact Numbers?
- How To Perform Comparison on Floating Point Numbers?
- How To Perform Comparison on Date and Time Values?
- How To Perform Comparison on Character Strings?
- What To Test Value Ranges with the BETWEEN Operator?
- What To Test Value Lists with the IN Operator?
- What To Perform Pattern Match with the LIKE Operator?
- How To Use Wildcard Characters in LIKE Operations?
- How To Test Subquery Results with the EXISTS Operator?
- How To Test Values Returned by a Subquery with the IN Operator?
- What Are Logical/Boolean Operations?
|