puiu91
3/8/2016 - 6:22 PM

SQL Alternatives to LIKE()

SQL Alternatives to LIKE()

-- method one
SELECT * 
FROM table
WHERE district REGEXP '2'

-- method two
SELECT *
FROM table
WHERE LOCATE(2, district)

-- method three
SELECT *
FROM table
WHERE INSTR(district, '2')

-- method four
SELECT *
FROM table
WHERE district LIKE '%2%'