Are Not Equal to Operators Equal to Not In? – SQL in Sixty Seconds #102

Are Not Equal to Operators Equal to Not In? - SQL in Sixty Seconds #102 102-NotIn-cover-800x447 What I love most about my job Comprehensive Database Performance Health Check, is that I get to work with different people and answer questions. Today we will see a very interesting question – Are Not Equal (<> or !=! to Operators Equal to Not In? 

To be honest the question was very interesting and I built a very simple video of SQL in the Sixty Seconds on it. Please watch the video and do let me know your feedback about it.

Here is a simple demonstration of the sample database WideWorldImporters. Here is the instruction to download them. I am sure the video gave you the required answer. Now let me share the script which I had used in the video.

USE WideWorldImporters
GO
SET STATISTICS IO ON;
SELECT DISTINCT LastEditedBy
FROM [Sales].[Orders]
WHERE LastEditedBy <>  7
		AND LastEditedBy <>  15
GO
SELECT DISTINCT LastEditedBy
FROM [Sales].[Orders]
WHERE LastEditedBy !=  7
		AND LastEditedBy !=  15
GO
SELECT DISTINCT LastEditedBy
FROM [Sales].[Orders]
WHERE LastEditedBy NOT IN (7,15)
GO

Here are links to the last seven videos which I have built in the SQL in the Sixty Seconds series besides today topic of operators equal.

You can follow my SQL in Sixty Seconds series on YouTube over here.

Reference: Pinal Dave (https://blog.sqlauthority.com)

SQL in Sixty Seconds, SQL Operator, SQL Scripts, SQL Server
Previous Post
Negative Identity Column – SQL in Sixty Seconds #101
Next Post
SQL SERVER – Offline, Detach and Drop – Differences – SQL in Sixty Seconds #103

Related Posts

1 Comment. Leave new

  • while and != are the same, the first is ANSI/ISO Standard SQL and the second is dialect taken from C family programming languages. When I see it, know that the programmer does not speak SQL, so I can predict his errors.

    Reply

Leave a Reply