How does INDEX work with MYSQL?
Suppose I got 2 tables like this
//customerTable
id auto_increment,
username char(30),
password char(40),
phone int(10)
//profileTable
id auto_increment,
username char(30),
description text
And I created an INDEX on username on both tables, like this
create index username on `customerTable` ( username, password )
create index username on `profileTable` ( username )
Then I run these queries:
select * from `customerTable` where username='abc' limit 1
select * from `customerTable` where username='abc' and password='xyzzzzz' limit 1
select customerTable.*, profileTable.* from
customerTable, profileTable where
customerTable.username='abc'
and customerTable.password='xyzzzzzzz'
and customerTable.username = profileTable.username
limit 1
Which indexes will these 3 queries use? Because name of both indexes is same...