Using MySQL LIKE operator you can search based on patterns. It is used in the WHERE clause in SELECT statement.
‘%’ – allows you to match zero or more characters
‘_’ – allows you to match any single character
For searching the first character starts with ‘a’ like andy, arnold:
SELECT * FROM users WHERE name LIKE ‘a%’;
For searching the last character ends with ‘ck’ like jack, drack:
SELECT * FROM users WHERE name LIKE ‘%ck’;
For searching the middle character with ‘ac’ like jack, drack:
SELECT * FROM users WHERE name LIKE ‘%ac%’;
For searching the name whose name starts with P and ends with m like pom, pim:
SELECT * FROM users WHERE name LIKE ‘p_m’;
You can also use NOT operator to like for exception:
SELECT * FROM users WHERE name NOT LIKE ‘a%’;
For any types of queries, you can contact us on info[at]namasteui.com.
Introduction: As the chill of winter settles in or a bout of cold weather strikes,…
Nestled along the glittering waterfront of the City of Gold, Dubai Marina beckons to discerning…
When was the last time you heard that a clone app like Gojek could efficiently…
The e-commerce market is growing and evolving at a rapid pace. More and more people…
Navigating through a personal injury claim can be a complex and daunting process. If you've…
IplWin stands as a reliable and enthralling platform for Indian punters, offering a captivating blend…