Is there any reason to use id int auto-increment for a primary key while a UNIQUE column (that is not a foreign key or anything) already exists in a table?
I'm reading someone else's thesis about a project that uses freebase data. Every topic in freebase is uniquely identified by an mid. (example: m.gugkl395).
But instead of using mid as the primary key in the topics table he chose to use an id (int auto-increment). So the topics table looks like this
CREATE TABLE topics (
id INT NOT NULL AUTO-INCREMENT,
mid VARCHAR(254) NOT NULL UNIQUE,
name VARCHAR(254) NOT NULL,
description VARCHAR(2048),
type VARCHAR(254) NOT NULL,
PRIMARY KEY (id)
);
I should mention that there are 3 other tables that use this id as a foreign key and that because it has to do with freebase there will probably be a lot of data in the database. Also in case it matters MySQL version 5.7.15 is being used.