SQL keys,MUL vs PRI vs UNI
1137 ワード
要約:http://stackoverflow.com/questions/5317889/sql-keys-mul-vs-pri-vs-uni/15268888#15268888
SQL keys,MUL vs PRI vs UNI PRI UNI MUL The meaning of PRI and UNI are quite clear:
PRI=>primary key
UNI=>unique key
The third possibility,MUL,is baicallyan index that is neither a primrykey nor a unique key.The name compes from“multile”because multiple occurence of the same valute Store.slashare。http://dev.mysql.com/doc/refman/5.1/en/show-columns.html
「If Key is MUL,the column is the first column of a nonunique index in which multiple occurrences of a given value are permitted within the column.」
The re is also a final caveat:
「If more than one of the Key values appies to a given column of a table,Key displays the one with the highest prorit,in the order PRI,UNI,MUL.」
As a general note,the MySQL documentation is quite good.When in doub,check it out!
===END======
SQL keys,MUL vs PRI vs UNI
DESCRIBE <table>;
This is acutally a shartcut for:SHOW COLUMNS FROM <table>;
In any case,there re three possible values for the「Key」atribute:PRI=>primary key
UNI=>unique key
The third possibility,MUL,is baicallyan index that is neither a primrykey nor a unique key.The name compes from“multile”because multiple occurence of the same valute Store.slashare。http://dev.mysql.com/doc/refman/5.1/en/show-columns.html
「If Key is MUL,the column is the first column of a nonunique index in which multiple occurrences of a given value are permitted within the column.」
The re is also a final caveat:
「If more than one of the Key values appies to a given column of a table,Key displays the one with the highest prorit,in the order PRI,UNI,MUL.」
As a general note,the MySQL documentation is quite good.When in doub,check it out!
===END======