Adding index for a table
August 3, 2007In Excel:
Approach #1: In the cell 1 of the index row, type in “1″ and cell 2, type in “2″. Select both cells. Excel highlights both cells with bold-stroked box. There is a small handler on the bottom-right corner (Supposed to be a feature called “Auto Fill”?) Hold and drag the handler all the way down to the last cell on the index row. Excel should autofill all the rest of the cells.
Approach #2: In the cell 1 of the index row, type in “1″. In cell 2, type in “=ROW_NUM1+1″ (For example, if this is row A, type in “=A1+1″. What this formula does is to increment the value of cell 1 by 1, which equals to 2.) Select cell 2; drag the small handler on the bottom-right to all the way down the last cell.
In MySQL:
Approach #3: Create a column which is primary key, data type of int and attribute of AUTO_INCREMENT.


