You cannot combine LIKE and IN.

The statement below would do the job though:

SELECT *
FROM Table1 
WHERE EmpPU NOT LIKE '%CSE%' 
  AND EmpPU NOT LIKE '%ECE%' 
  AND EmpPU NOT LIKE '%EEE%';
Answer from Paddy on Stack Overflow
🌐
W3Schools
w3schools.com › sql › sql_not.asp
SQL NOT Operator
SQL Examples SQL Editor SQL Quiz ... SQL Certificate SQL Training ... The NOT operator is used in combination with other operators to give the opposite result, also called the negative result....
Discussions

NOT LIKE with '%'
but for finding cities that do not start or end with vowel I can't just add a NOT into the above SQL, instead I have to do ... your colloquial use of 'OR' trips you up here, i think. your last query finds cities that NEITHER start NOR end with a vowel. Which, indeed, is NOT a reversal of your original query. More on reddit.com
🌐 r/SQL
9
1
March 7, 2024
SQL LIKE ANd NOT LIKE - SQLTeam.com Forums
Hi All, I am wondering if someone could help me with an SQL query. I need to return results from a table with words which have 'an' in them; so I am using '%an%' but i don't want the word 'AND' to show up which it is doing. How can I have one but leave out 'and'? Thanks! More on forums.sqlteam.com
🌐 forums.sqlteam.com
0
February 24, 2020
NOT LIKE Alternatives in WHERE clause – SQLServerCentral Forums
NOT LIKE Alternatives in WHERE clause Forum – Learn more on SQLServerCentral More on sqlservercentral.com
🌐 sqlservercentral.com
May 30, 2023
What is NOT LIKE operator in SQL?
In SQL, the NOT LIKE operator is used in conjunction with the WHERE clause to filter the results returned by a query based on patterns that do not match the specified criterion. Essentially, it is the negation of the LIKE operator, which is used to find rows that match a specified pattern. More on designgurus.io
🌐 designgurus.io
1
10
June 25, 2024
🌐
Educative
educative.io › answers › what-is-not-like-operator-in-sql
What is NOT LIKE operator in SQL?
The NOT LIKE operator is a negation of the LIKE operator. The following is the basic syntax for using SQL’s NOT LIKE operator.
🌐
DigitalOcean
digitalocean.com › community › tutorials › sql-like-sql-not-like
SQL Like - SQL Not Like | DigitalOcean
August 4, 2022 - SELECT CustomerName FROM Customer WHERE CustomerName NOT LIKE 'A%'; ... We can have multiple like statements in SQL query.
🌐
Reddit
reddit.com › r/sql › not like with '%'
r/SQL on Reddit: NOT LIKE with '%'
March 7, 2024 -

So using MS SQL Server, I am wondering why this works (get cities that start and end with vowel)

SELECT DISTINCT CITY FROM STATION WHERE CITY LIKE '[AEIOU]%[AEIUO]'

but for finding cities that do not start and end with vowel I can't just add a NOT into the above SQL, instead I have to do

SELECT DISTINCT CITY FROM STATION WHERE CITY NOT LIKE '[AEIOU]%' AND CITY NOT LIKE '%[AEIUO]'

🌐
dbt
docs.getdbt.com › sql-reference › like
Working with the SQL LIKE operator
4 days ago - Bucket column values together based on general requirements using case statements and the LIKE operator (ex. case when page_path like '/product%' then 'product_page' else 'non_product_page') Filter out employee email records based on a similar email address pattern (ex. where email_address not like '%@dbtlabs.com')
Find elsewhere
🌐
LearnSQL.com
learnsql.com › blog › like-sql-not-like
What Do the Operators LIKE and NOT LIKE Do? | LearnSQL.com
March 4, 2021 - However, it can be used anywhere you use an expression in SQL. SQL NOT LIKE operator behaves as you might expect, essentially returning the opposite of what the LIKE operator would.
🌐
Programiz
programiz.com › sql › like-operator
SQL LIKE and NOT LIKE Operators (With Examples)
SELECT column1, column2, ... FROM table_name WHERE column NOT LIKE value; ... Here, the SQL command selects all customers except those whose country is USA.
🌐
SQLTeam
forums.sqlteam.com › t › sql-like-and-not-like › 17338
SQL LIKE ANd NOT LIKE - SQLTeam.com Forums
February 24, 2020 - Hi All, I am wondering if someone could help me with an SQL query. I need to return results from a table with words which have 'an' in them; so I am using '%an%' but i don't want the word 'AND' to show up which it is d…
🌐
SQLServerCentral
sqlservercentral.com › forums › topic › not-like-alternatives-in-where-clause
NOT LIKE Alternatives in WHERE clause – SQLServerCentral Forums
May 30, 2023 - DROP TABLE IF EXISTS returned_products; GO CREATE TABLE returned_products( returned_products_id INT IDENTITY(1,1), returned_products_reason VARCHAR(1000)) ALTER TABLE returned_products ADD CONSTRAINT returned_products_PK PRIMARY KEY (returned_products_id); DECLARE @c_reason_1 VARCHAR(100) = 'reason_1', @c_reason_2 VARCHAR(100) = 'reason_2', @c_reason_3 VARCHAR(100) = 'reason_3'; INSERT INTO returned_products(returned_products_reason) VALUES(@c_reason_1), (@c_reason_2), (@c_reason_1+@c_reason_3), (@c_reason_1+@c_reason_3+@c_reason_2) SELECT rp.* FROM returned_products rp WHERE rp.returned_products_reason NOT LIKE '%'+@c_reason_3+'%' AND rp.returned_products_reason NOT LIKE '%'+@c_reason_2+'%'
🌐
Microsoft Learn
learn.microsoft.com › en-us › sql › t-sql › language-elements › like-transact-sql
LIKE (Transact-SQL) - SQL Server | Microsoft Learn
For more information, see COLLATE (Transact-SQL). If the LIKE '5%' symbol is specified, the Database Engine searches for the number 5 followed by any string of zero or more characters. For example, the following query shows all dynamic management views in the AdventureWorks2025 database, because they all start with the letters dm. -- Uses AdventureWorks SELECT Name FROM sys.system_views WHERE Name LIKE 'dm%'; GO · To see all objects that aren't dynamic management views, use NOT LIKE 'dm%'. If you have a total of 32 objects and LIKE finds 13 names that match the pattern, NOT LIKE finds the 19 objects that don't match the LIKE pattern.
🌐
Data.world
docs.data.world › documentation › sql › concepts › basic › LIKE_and_NOT_LIKE.html
LIKE and NOT LIKE | SQL Tutorial Documentation on data.world
September 30, 2025 - SELECT monthyear, name, age_upon_outcome, sex_upon_outcome, outcome_type, outcome_subtype, breed FROM austin_animal_center_outcomes WHERE animal_type = "Dog" AND breed LIKE "%wolfhound%" ORDER BY monthyear · siyeh/austin-animal-center-statistics-oct-1-2013-to-dec-7-2017 Run query Copy code ... Sometimes it’s necessary to search for an instance of one of the characters used as wildcards. It’s common to have yet another character called an escape character which is placed before a wildcard character in a search string to indicate that the character is to be taken literally and not used as a wildcard.
🌐
UniversalClass
universalclass.com › articles › computers › sql › using-the-in-not-and-like-operators-in-sql.htm
Using the IN, NOT, and LIKE Operators in SQL
The SQL language lets you combine NOT and LIKE to eliminate search results using the same type of logic except records are removed from a data set instead of adding them. For instance, instead of searching for customers in cities that start with "Da," you can exclude customers that are located ...
🌐
W3Schools
w3schools.com › sql › sql_any_all.asp
SQL ANY and ALL Operators
SQL Examples SQL Editor SQL Quiz SQL Exercises SQL Server SQL Syllabus SQL Study Plan SQL Bootcamp SQL Certificate SQL Training ... The ANY and ALL operators allow you to perform a comparison between a single column value and a range of other values. ... ANY means that the condition will be true if the operation is true for any of the values in the range. SELECT column_name(s) FROM table_name WHERE column_name operator ANY (SELECT column_name FROM table_name WHERE condition); Note: The operator must be a standard comparison operator (=, <>, !=, >, >=, <, or <=).
Top answer
1 of 2
3

From a logical perspective, these are exactly the same.

Even the presence of NULL does not affect it, because if the column is NULL then [Column] LIKE '%pattern%' evaluates to UNKNOWN and NOT UNKNOWN is still UNKNOWN and therefore fails the WHERE.

As far as actual implementation, not only are the logically the same, they actually execute the same code.

A careful inspection of the XML query plans reveals the below XML in the case of [Column] NOT LIKE

<Predicate>
    <ScalarOperator ScalarString="NOT [fiddle_bf98353ecbfa4f60a8c1d988014ffc03].[dbo].[t].[Column] like &apos;%pattern%&apos;">
        <Logical Operation="NOT">
            <ScalarOperator>
                <Intrinsic FunctionName="like">
                    <ScalarOperator>
                        <Identifier>
                            <ColumnReference Database="[fiddle_bf98353ecbfa4f60a8c1d988014ffc03]" Schema="[dbo]" Table="[t]" Column="Column"></ColumnReference>
                        </Identifier>
                    </ScalarOperator>
                    <ScalarOperator>
                        <Const ConstValue="&apos;%pattern%&apos;"></Const>
                    </ScalarOperator>
                </Intrinsic>
            </ScalarOperator>
        </Logical>
    </ScalarOperator>
</Predicate>

And this in the case of NOT [Column] LIKE

<Predicate>
    <ScalarOperator ScalarString="NOT [fiddle_bf98353ecbfa4f60a8c1d988014ffc03].[dbo].[t].[Column] like &apos;%pattern%&apos;">
        <Logical Operation="NOT">
            <ScalarOperator>
                <Intrinsic FunctionName="like">
                    <ScalarOperator>
                        <Identifier>
                            <ColumnReference Database="[fiddle_bf98353ecbfa4f60a8c1d988014ffc03]" Schema="[dbo]" Table="[t]" Column="Column"></ColumnReference>
                        </Identifier>
                    </ScalarOperator>
                    <ScalarOperator>
                        <Const ConstValue="&apos;%pattern%&apos;"></Const>
                    </ScalarOperator>
                </Intrinsic>
            </ScalarOperator>
        </Logical>
    </ScalarOperator>
</Predicate>

In other words, they are exactly the same.

2 of 2
3

I believe the best way is to Test yourself and check how it really works out in the Lab.

I am having Stackoverflow database in my Lab and I conducted the test and could see that there is no difference whatsoever whether it is logical read or CPU time or Execution plan.

Below is the Screenshot of Logical Reads and Time Stats:

Now, lets check the execution plan:

Also to add here that, I have an index on Location column however due to high number of rows as well as *(all columns) in select, optimizer preferred to go for Clustered Index Scan.

If I change the query and take only Location column in the select, Nonclustered index scan is performed however no change in the performance or execution plan.

Please be mindful of leading wildcard in the where clause as it will have to do full column scan instead of seek operation as it needs to search the complete string.

🌐
Hightouch
hightouch.com › sql-dictionary › sql-not-equal-to
SQL Not Equal To - Syntax, Use Cases, and Examples | Hightouch
January 3, 2024 - The SQL "Not Equals To" operator, denoted as "<>", "!=", or "NOT =", is used to compare values in a database table and retrieve rows where a specific column's value does not match a given criteria.
🌐
SQL Training Online
sqltrainingonline.com › home › blog › sql training › sql not like with multiple values
SQL Not Like with Multiple Values - SQL Training Online
January 18, 2013 - They were trying to exclude multiple values from the SQL query, but they were needing to use wildcards. If you wanted to just filter values without wildcards, you would use the following query. select * from table1 where column1 not in ('value1','value2','value3'); The only problem was that they needed to compare using the LIKE operator.
🌐
W3Schools
w3schools.com › sql › sql_wildcards.asp
SQL Wildcard Characters
A wildcard character is used to substitute one or more characters in a string. Wildcard characters are used with the LIKE operator. The LIKE operator is used in a WHERE clause to search for a specified pattern in a column.