Answer the question
In order to leave comments, you need to log in
Table with auto_increment without primary key?
The bottom line is that there is a table, it has an ID field and there are two more fields, let's call them field1 and field2, how to make it so that it would be impossible to insert two records with the same field1 and field2, but what if there was an ID field and it was auto_increment?
Answer the question
In order to leave comments, you need to log in
And how is it connected " so that it would be impossible to insert two records with the same field1 and field2 " with " Table with auto_increment without primary key "?
To make it impossible to insert 2 records with the same field1 and field2, you need to make a unique index on these fields:
UNIQUE KEY `name1_name2` (`name1`,`name2`)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question