Yes, it will use the index.
*BUT* queries such as
SELECT * FROM data WHERE name='john'
SELECT * FROM data WHERE surname='jones'
SELECT * FROM data WHERE city='boston'
could *NOT* use the index!!!
That's because MySQL can only use an index in LEFT-TO-RIGHT ORDER, with *NO* skipping of fields.
In other words it could use the index for a query that used:
id and name
id and name and surname
id and name and surname and city
But *ONLY* those combinations.
So it's probably NOT a good idea to use a single index like that.
*PROBABLY* you should have these three indexes:
CREATE UNIQUE INDEX data_id ON data(id)
CREATE INDEX data_surname_name ON data(surname, name)
CREATE INDEX data_city ON data(city)
However, if id
is your primary key, then you should not have a separate UNIQUE INDEX for it. The primary key is already a unique index.