Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

185
Views
How to use "NOT LIKE" for a column values in SQL

So I have a table like this:

X.        Y.
34560     eudhkri 34560 abc
26558     hsyrb 26558 ax
3666      dhurb 3666 yzhdj
3666      dhfhjf 366688 avh
233       abc 233 hdhsijej

Since characters in the Y column are changeable (meaning they have different number of letters) I thought I might use the NOT LIKE operator to exclude the rows where the X value is in the Y column.

However, I don't know how. It is not possible to just write it every values of X down. Also, I wrote the 4th row specifically to show you I can't exclude this data since the numbers are not same, so using % might cause some trouble.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

You could use a regular expression:

WHERE y ~ ('\m' || x || '\M')

\m marks the beginning of a word, \M the end.

over 4 years ago · Santiago Trujillo Report

0

if you want to use the like operatoe you could try this way

select *
from my_table 
where y NOT like concat('%',x,'%')

or

select *
from my_table 
where y NOT like concat('% ', x,' %')
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!