meaning of %%% in sql query?
sql
Solution
Turns out in mysql it matches everthing:
mysql> create database foo;
Query OK, 1 row affected (0.06 sec)
mysql> use foo;
Database changed
mysql> create table foo ( bar char(20) );
Query OK, 0 rows affected (0.06 sec)
mysql> desc foo;
+-------+----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+----------+------+-----+---------+-------+
| bar | char(20) | YES | | NULL | |
+-------+----------+------+-----+---------+-------+
1 row in set (0.00 sec)
mysql> insert into foo values ('endwith%');
Query OK, 1 row affected (0.05 sec)
mysql> insert into foo values ('%startwith');
Query OK, 1 row affected (0.00 sec)
mysql> insert into foo values ('cont%ins');
Query OK, 1 row affected (0.00 sec)
mysql> insert into foo values ('doesnotcontain');
Query OK, 1 row affected (0.00 sec)
mysql> select * from foo where bar like '%%%';
+----------------+
| bar |
+----------------+
| endwith% |
| %startwith |
| cont%ins |
| doesnotcontain |
+----------------+
4 rows in set (0.00 sec)
Problem
I am familiar with this kind of query: ``` select * from tableA where foo like '%bar%' ``` But today I run into three adjacent percentage signs in some legacy code, like this: ``` select * from tableA where foo like '%%%' ``` This query seems to work, both on mssql and oracle, when foo is of string type (varchar, etc.) but it fails when foo is numeric. Any idea what it means? EDIT: sorry about the typo in original question, the query uses the LIKE operator.