MySQL is capable of returning the result of a LIKE directly in the result set itself.
For example, if you use a wildcard character in a query such as below, you get to know if the result is true or false based on the value of the resulting column. If the value is 1, it implies the result is true. If the value is 0, it implies the result is false.
Create code for the table under consideration.
CREATE TABLE `FILEDATA` ( `ID` INT(11) NOT NULL, `FILEPATH` TEXT NOT NULL COLLATE 'utf8_bin')COLLATE='utf8_bin'ENGINE=InnoDB;
Data for the table
+-----+-------------+| ID | FILEPATH |+-----+-------------+| 1 | /root || 2 | /opt/tab || 3 | /etc/init.d |+-----+-------------+
And now, our query.
SELECT FILEPATH, FILEPATH LIKE '/%' FROM FILEDATA
Output:
+-------------+--------------------+| FILEPATH | FILEPATH LIKE '/%' |+-------------+--------------------+| /root | 1 || /opt/tab | 1 || /etc/init.d | 1 |+-------------+--------------------+
Yes, you can try with other options as well. Exploring is good.