mysql two column combination unique
CREATE TABLE `content_html` ( `id` int(11) NOT NULL AUTO_INCREMENT, `id_box_elements` int(11) DEFAULT NULL, `id_router` int(11) DEFAULT NULL, `content` mediumtext COLLATE utf8_czech_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id_box_elements` (`id_box_elements`,`id_router`) );
Source: stackoverflow.com
mysql unique two columns
CREATE TABLE IF NOT EXISTS cliente ( id bigint primary key auto_increment, nome varchar(100) not null, email varchar(100) not null unique, senha varchar(255) not null, documento varchar(50) not null unique, dataCadastro date not null ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;