" or "!=" symbols to express inequality. These two symbols are used to check whether a field is not equal to a specified "value"."/> " or "!=" symbols to express inequality. These two symbols are used to check whether a field is not equal to a specified "value".">
You can use "" or "!=" symbols in SQL to indicate inequality. These two symbols are used to check whether a field is not equal to a specified "value".
In SQL, it means not equal
In SQL, not equal can use "" or "!=" symbol indicates.
Use
SELECT * FROM table_name WHERE column_name <> value;
Use !=
SELECT * FROM table_name WHERE column_name != value;
Both symbols can be used to check fields Is not equal to the specified "value".
Example
In the following example, we use the "" symbol to query all records in the "customers" table where the "age" field is not equal to 30:
SELECT * FROM customers WHERE age <> 30;
If the "customers" table has the following data:
id | name | age |
---|---|---|
1 | John | 30 |
2 | Mary | 25 |
3 | Bob | 35 |
4 | Alice | 28 |
Then the above query will return the following results:
id | name | age |
---|---|---|
2 | Mary | 25 |
4 | Alice | 28 |
The above is the detailed content of How to express not equal in sql. For more information, please follow other related articles on the PHP Chinese website!