|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
I am having trouble understanding when and where to use KEY/INDEX.
Can someone give me a good example of where I would and would NOT use it? If I have a database full of books and prices which people are searching, is that a good place to put in a key? |
|
#2
|
|||
|
|||
|
Does the "books" column have a complementary unique key column associated with it, e.g. "book_id" where you use an auto_increment integer or the ISBN to uniquely identify it? If that is the case then that column should be the primary key. If not, then you could make the "book" column the primary key if there would be no duplicate book names in the database (risky...) Suggest putting in a primary key column to uniquely identify each and every book and then use an INDEX on the book column to optimize search performance.
|
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > Keys |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|