Category Archives: sql

How to make a field unique in existing database table

In order to make a field unique in your existing table you can either run a sql statement or use a visual sql client like HeideSQL.

This is an example on how to make your emp_id field unique in your existing employee table.


ALTER TABLE `employee` ADD UNIQUE INDEX `emp_id` (`emp_id`);