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