SELECT 'AA' LIKE 'A%', 'AA' LIKE 'A\%', 'A%' LIKE 'A\%'; : Like « Select Clause « SQL / MySQL






SELECT 'AA' LIKE 'A%', 'AA' LIKE 'A\%', 'A%' LIKE 'A\%';

       
mysql>
mysql> SELECT 'AA' LIKE 'A%', 'AA' LIKE 'A\%', 'A%' LIKE 'A\%';
+----------------+-----------------+-----------------+
| 'AA' LIKE 'A%' | 'AA' LIKE 'A\%' | 'A%' LIKE 'A\%' |
+----------------+-----------------+-----------------+
|              1 |               0 |               1 |
+----------------+-----------------+-----------------+
1 row in set (0.00 sec)

mysql>
mysql> SELECT 'AA' LIKE 'A_', 'AA' LIKE 'A\_', 'A_' LIKE 'A\_';
+----------------+-----------------+-----------------+
| 'AA' LIKE 'A_' | 'AA' LIKE 'A\_' | 'A_' LIKE 'A\_' |
+----------------+-----------------+-----------------+
|              1 |               0 |               1 |
+----------------+-----------------+-----------------+
1 row in set (0.00 sec)

mysql>

   
    
    
    
    
    
    
  








Related examples in the same category

1.Use LIKE
2.Use LIKE for matching substring
3.Pattern match with LIKE
4.Where clause: like and %
5.Where clause: regular expressions
6.Where clause: regular expression 2
7.Use LIKE in where clause
8.Pattern Matching with LIKE
9.Using LIKE with SQL Pattern Matches
10.To invert a pattern match, use NOT LIKE rather than LIKE: