* Andy Cheng
> I am trying to learn about indexing and have a few questions.
>
> 1. Does index only apply to query that use = operator in the where clause?

No.

> 2. Does operators such as >, like and between will result to full table
> scan?

No. LIKE "%whatever%" will not use the index, but LIKE "whatever%" will.

> 3. For example, In the following table:
>
> tbl_A
> --------
> id int primary key,
> flag1 char(1),
> amount float,
> signup_date date
>
>
> In a query has multiple condition in the where clause such as,
>
> select * from tbl_A where flag1 = 'y' and amount > 10 and signup_date
> between '2002-02-01' and '2002-03-31'.
>
> If only the flag and signup_date field has index, will the index be use?

If multiple indexes exist, mysql will try to use the best for the situation,
as it can only use one index per query. (one index per table per query when
you use JOIN's.)

You can check what index mysql will use by prefixing your query with the
word EXPLAIN.

<URL: http://www.mysql.com/doc/E/X/EXPLAIN.html >

> 4.  Where could I learn more about indexing?

The above URL is rather informative, see also:

<URL: http://www.mysql.com/doc/M/y/MySQL_indexes.html >
<URL: http://www.mysql.com/doc/C/R/CREATE_INDEX.html >

--
Roger


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to