At 16:53 +0100 8/5/03, eli wrote:
Hi,

I have a question about using LIKE or equal.

I mean, comparing two strings with exact coincidence, without case
sensitive, which is better? Or are they the same? Do they work equal?

For Instance.

"abc"="abc"

Or

"abc" LIKE "abc"

I use Mysql 4.0.12.

Thanks in advanced.

Eli

Functionally, the two expressions are the same. In terms of efficiency, the "=" operator's probably somewhat better than LIKE. You can try checking this for yourself as follows:

mysql> select benchmark(10000000,'abc' LIKE 'abc');
+--------------------------------------+
| benchmark(10000000,'abc' LIKE 'abc') |
+--------------------------------------+
|                                    0 |
+--------------------------------------+
1 row in set (2.60 sec)

mysql> select benchmark(10000000,'abc' = 'abc');
+-----------------------------------+
| benchmark(10000000,'abc' = 'abc') |
+-----------------------------------+
|                                 0 |
+-----------------------------------+
1 row in set (2.09 sec)


-- Paul DuBois, Senior Technical Writer Madison, Wisconsin, USA MySQL AB, www.mysql.com

Are you MySQL certified? http://www.mysql.com/certification/


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to