Question: I have a MYSql table with columns id,name,description and status. The id column is auto incremented and is primary key. Now, I want to add another column to the table named 'display\_priority'. I want the records to be pulled using 'order by' on this column. 

How can I auto populate this table(based on ID), while inserting records?
The display\_priority values do not matter while inserting. It shall be rearranged later on, at some point of time, before displaying the records. But, the inserted values need to be unique.

Any help? Thanks in advance.

Edit: I know that this can be done by an after insert trigger. What if, I wanted to avoid a trigger. Any other way?

Answer: 
If you want to avoid `TRIGGER` you could use the current `UNIX_TIMESTAMP` or `CURRENT_TIMESTAMP` as a default value. But if tow or more `INSERT` at the same second you have a problem ...

```
display_priority TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP

```
You could add a `TRIGGER` witch update the `display_priority` on insert and the value is the `maximum` of `display_priority` plus one.

```
CREATE TRIGGER table_name BEFORE INSERT ON display_priority
       FOR EACH ROW SET @sum = (SELECT MAX(display_priority)+1 FROM table_name);

```