How to use Single OR operator In SQL
SELECT * FROM CoursesActive
WHERE courseId = 1001
OR
courseName = 'Data Structures And Algorithms'
The Result Looks Like:
Explanation: In this query two condition are used where one condition is courseId> 1001 and the other is courseName = ‘Data Structures And Algorithms’ when any of the condition is true there is only one row.
SQL Server OR Operator
Logical operators are used for combining multiple boolean expressions which are a combination of results of multiple conditions which are formed by the comparators. Some of the logical operators are AND, OR, EXISTS, IN, LIKE, BETWEEN, etc, Logical operators are very frequently used and are very handy for testing multiple conditions. The logical operator OR is used for combining multiple boolean expressions and it returns true only when any one of the conditions is true. It is used primarily with WHERE, CASE, and HAVING clauses by specifying multiple boolean expressions that return any one of the following values True, or False.
Contact Us