Adding index for a table

In 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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: