(LIKE) Fetching Some table data where we don't know how the exactly data is written/spelled in table

PHOTO EMBED

Tue Feb 22 2022 21:35:33 GMT+0000 (Coordinated Universal Time)

Saved by @irfan309 #psql #like #select #where

# so the scenario is we have table called employees
# in employees table there is column called department 
# there are different departments are included in table
# now we want some department which we dont know how its spelled there so we are just
# trying to fetch the data in column which matched or containes 
# ex: word 'Clothing' is in stored in table but we dont know exactly how data spelled there
# so we try to match something like '% clo %'
# or 'C% thing %'

SELECT * FROM emploees  WHERE department like '% thing %';
# or 
SELECT * FROM employees WHERE department like 'C% thing %';
content_copyCOPY