How to create table with Unique Identifier field in MySQL?
I guess you're looking how to create a primary key? There is also auto increment, which you will probably need
Here is an example of a table creation:
CREATE TABLE `affiliation` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`affiliate_id` bigint(20) DEFAULT NULL,
`email_invited` varchar(255) DEFAULT NULL,
`email_provider` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8
I'm not familiar with the specifics of Unique Identifiers in MS SQL, but you may be able to get what you want with MySQL's UUID
function:
https://dev.mysql.com/doc/refman/5.0/en/miscellaneous-functions.html#function_uuid
I would put this in a VARCHAR
or CHAR
column with a UNIQUE
key.