perhaps? 2009-04-02 00:32 采纳率: 66.7%
浏览 185

Mysql 中 INDEX、 PRIMARY、 UNIQUE、 FULLTEXT 之间的差异?

What are the differences between PRIMARY, UNIQUE, INDEX and FULLTEXT when creating MySQL tables?

How would I use them?

转载于:https://stackoverflow.com/questions/707874/differences-between-index-primary-unique-fulltext-in-mysql

  • 写回答

3条回答 默认 最新

  • 关注

    All of these are kinds of indices.

    primary: must be unique, is an index, is (likely) the physical index, can be only one per table.

    unique: as it says. You can't have more than one row with a tuple of this value. Note that since a unique key can be over more than one column, this doesn't necessarily mean that each individual column in the index is unique, but that each combination of values across these columns is unique.

    index: if it's not primary or unique, it doesn't constrain values inserted into the table, but it does allow them to be looked up more efficiently.

    fulltext: a more specialized form of indexing that allows full text search. Think of it as (essentially) creating an "index" for each "word" in the specified column.

    评论

报告相同问题?