I have been using:
PRIMARY KEY (id), UNIQUE id (id), KEY id_2 (id)
whenever I create a table, but I dont understand what KEY id_2 (id) does and why?
I've searched everywhere and cannot find a suitable answer. Thanks!
Based on your example, I believe you're creating three different indexes on one column... which probably isn't what you were intending to do.
First, you're creating a primary key:
PRIMARY KEY (id)
Next, you're creating a unique index, which isn't necessary, because you already have the primary key... and you name this unique index id:
UNIQUE id (id)
Finally, you create a third index named id_2:
KEY id_2 (id)
Instead, I think you should be creating just the primary key, and forgo the other two indexes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With