I have a MySQL table with these fields:
Id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
Name VARCHAR(255) NOT NULL UNIQUE,
ReleaseDate DATETIME(6) NOT NULL DEFAULT "1970-01-01"
The default ordering of this table is by the Id
because it is the primary key. When I drop the Id
column and make the Name
the primary key the table is ordered alphabetically, which is what I want.
With the Id
as the primary key and the Name
is a UNIQUE
index the table continues to remain ordered in order of increasing Id
. I know I can use ORDER BY Name
when displaying the table but is there a way to configure the table itself to always remain in alphabetical name order, and completely disregard the order of the Id column?