mysql not unique auto increment, primary key two fields
问题 I want to create a table structure like this in MySQL: id | area | name ----+----------+------------ 1 | name-1 | test | | 1 | name-1 | value2 | | 2 | name-2 | test-value | | 3 | name-3 | test | | 3 | name-3 | test ie. the primary key will be: primary_key( id, area ) and the id will be auto_increment , but i only want the id to increment for every new unique area is this possible? 回答1: What you want is not possible. You want id and area to be the primary key but in your example they are not