Thursday, January 23, 2025
HomeConversionsSQL NOT EQUAL Operator

SQL NOT EQUAL Operator

In SQL, the NOT EQUAL operator is used to filter records that do not match a specified value. There are two common ways to express the “not equal” condition in SQL:

  1. !=: This is the most commonly used operator for “not equal” in many SQL dialects (e.g., MySQL, SQL Server, PostgreSQL).
  2. <>: This is the standard SQL operator for “not equal” and works across almost all SQL databases.
See also  How much is 3 ounces of cream cheese?

Example:

If you want to select all records from a students table where the age is not equal to 18, you can write the query like this:

SELECT * FROM students
WHERE age != 18;

or using <>:

SELECT * FROM students
WHERE age <> 18;

Both queries will return rows where the age is not 18.

RELATED ARTICLES
0 0 votes
Article Rating

Leave a Reply

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
- Advertisment -

Most Popular

Recent Comments

0
Would love your thoughts, please comment.x
()
x