Why most SQL databases allow defining the same index twice?

后端 未结 6 1460
没有蜡笔的小新
没有蜡笔的小新 2021-01-21 20:09

Why most SQL databases allow defining the same index (or constraint) twice?

For example in MySQL I can do:

CREATE TABLE testkey(id VARCHAR(10) NOT NULL,          


        
6条回答
  •  无人共我
    2021-01-21 20:31

    You shouldn't be in a scenario that you have so many indexes on a table that you can't just quickly look and see if the index in there.

    As for naming constraints and indexes, I only really ever name constraints. I will name a constraint FK_CurrentTable_ForeignKeyedColumn, just so things are more visible when quickly looking through lists of them.

提交回复
热议问题