Thread: Keys

  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 1999
    Rep Power
    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. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 1999
    Annapolis, Maryland US
    Rep Power
    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.

Similar Threads

  1. primary and foreign keys
    By jp1234 in forum Database Management
    Replies: 7
    Last Post: February 10th, 2004, 02:24 PM
  2. Nulls as foreign keys
    By braveheart in forum MySQL Help
    Replies: 4
    Last Post: December 8th, 2003, 07:01 AM
  3. store a tree (foreign keys)
    By alberthendriks in forum MySQL Help
    Replies: 2
    Last Post: February 1st, 2003, 08:05 AM
  4. Reuseable integer keys
    By JMM in forum Database Management
    Replies: 4
    Last Post: June 7th, 2002, 02:21 PM
  5. Foreign keys support front end program
    By Alkis in forum MySQL Help
    Replies: 3
    Last Post: October 31st, 2001, 03:35 AM

IMN logo majestic logo threadwatch logo seochat tools logo