Using auto-increment in mysql

This is a short guide that will teach you how you can auto-increment a field in a mysql table. What auto-increment does is to fill up a value for a field without user intervention. It automatically generates auto-incrementing values as you use an insert query. Auto-increment values are usually used as a primary key or unique key for a certain table in a database.

Here’s a screenshot that will give you an idea on how to auto-increment a field.

image

The value that would be inserted in this field would be 1 to n. Where n is the numeric value of the last record that you have inserted in the table.

When you perform an insert query, you don’t need to supply values on these fields. That’s very useful because the amount of time needed to complete a form is diminished because a unique number for the primary key is automatically generated.

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