How to make SQL Table Column data UNIQUE

I created this Clubs table in my SQL database but I want to make name row unique such that two rows will not have the same name.
CREATE TABLE clubs (
`id` integer PRIMARY KEY AUTO_INCREMENT,
`name` VARCHAR(45) NOT NULL,
`league` VARCHAR(45) NOT NULL,
`isActive` BOOLEAN,
created TIMESTAMP NOT NULL DEFAULT NOW()
);
CREATE TABLE clubs (
`id` integer PRIMARY KEY AUTO_INCREMENT,
`name` VARCHAR(45) NOT NULL,
`league` VARCHAR(45) NOT NULL,
`isActive` BOOLEAN,
created TIMESTAMP NOT NULL DEFAULT NOW()
);
4 Replies
StefanH
StefanH17mo ago
Add UNIQUE to the column definition
Leke
Leke17mo ago
Thanks
Unknown User
Unknown User17mo ago
Message Not Public
Sign In & Join Server To View
Leke
Leke17mo ago
Thanks, the documentation is really helpful