Tag 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`);

How to easily sort table fields using HeidiSQL

Using an SQL query you can sort a field in your database table. It’s either moving up or down. In some cases, you need to sort your newly inserted fields according to the level of importance. It really depends on your preference though. In this case, the newly inserted database field is very important that you are dying to place it to the top next to id.
Continue reading “How to easily sort table fields using HeidiSQL” »