Comparison operators in SQL Server
This article will show the comparison operators that are used to check for equilibrium along with more advanced operators in SQL Server.
This article will show the comparison operators that are used to check for equilibrium along with more advanced operators in SQL Server. Readers can refer to the article Operator in SQL.
The comparison operator is used in the WHERE clause to determine which record selection. This is a list of comparison operators you can use in SQL Server (T-SQL).
Operator Description = Equal to <> Not equal to! = Not equal to> Greater than> = Greater than or equal to Not greater!There are many comparison operators in SQL Server and Transact-SQL. Here's how to use some common operators.
Example - Peer operator
SELECT *
FROM nhanvien
WHERE ten = 'Jane';
In this example, the SELECT statement returns results from rows from the table with employees named Jane.
Example - Non-peer operator
In SQL Server, you can use <> or! = To check non-peer properties in queries.
SELECT *
FROM nhanvien
WHERE ten <> 'Jane';
The SELECT statement above will return rows in the nhanvien table whose name is not Jane. The above command can be written differently as follows. Both queries produce the same result set.
SELECT *
FROM nhanvien
WHERE ten != 'Jane';
Example - Larger operator
SELECT *
FROM nhanvien
WHERE nhanvien_id > 3000;
The result of the above SELECT statement is the rows in the table where the employee ID is greater than 3000, the employee ID of 3000 will not be in the result.
Example - Operator greater than or equal to
SELECT *
FROM nhanvien
WHERE nhanvien_id >= 3000;
The above example will return rows with employee ID greater than or equal to 3000 in the table.
Example - Smaller operator
SELECT*
FROM nhanvien
WHERE nhanv
ien_id <500;
Similarly, the result of this command is the rows in the bank with the employee ID less than 500, not including the ID 500.
For example - Operator less than or equal to
SELECT *
FROM nhanvien
WHERE nhanvien_id
<= 500;
The result of this command is the rows in the table with the value of less than or equal to 500.
Example - Advanced operator or logical operator
The advanced operators below will have specific instructions for them.
IN ()
NOT
BETWEEN
IS NULL
IS NOT NULL
LIKE
EXISTS
Previous article: FROM clause in SQL Server
Next article: WHERE clause in SQL Server
You should read it
- Operator in C ++
- Operator in PHP
- AND conditions in SQL Server
- Combine AND and OR conditions in SQL Server
- UNION ALL operator in SQL Server
- OR conditions in SQL Server
- INTERSECT operator in SQL Server
- ! = and! == What is the difference in JavaScript?
- Boolean operators AND and OR in SQL
- C Shell operators
- Basic Shell operators
- Korn Shell Operator
Maybe you are interested
5 quietest keyboards Invite to download the space theme wallpapers on the NASA XS inspired by NASA 5 simple ways to help you remember everything in life If we bring a part of the Sun to Earth, what terrible thing will happen? The Earth's core and the Sun's surface, which is hotter? Terrifying scenario if the Earth lost oxygen in 5 seconds?