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)