Is it better way to index a table ?
A:
Your database engine very likely creates an index for unique fields and primary keys automatically.
But of course you can also create indexes manually. Read about creating indexes in MySQL.
To give you better information, please clarify your question and specify which DB engine you use.
Felix Kling
2010-06-22 07:25:12
+1
A:
Most relational databases are capable of creating and maintaining a index.
Like metioned in the previous answer, unique and primary key fields are often indexed.
The statement for creating custom index would be something like that:
CREATE INDEX index_name ON table_name( col_name)
But keep in mind, while a index CAN speed up your selects it CAN slow down your inserts and updates.
Jerome
2010-06-22 07:29:02