02 October 2009

1 SQL Tutorial - Insert Zero in the auto incremental field

SQL Tutorial - MySQL Tips1 - Inserting Zero in the auto incremental field

How to insert a " 0" or zero value in the auto incremental column of MySQL ?

The following query will be setting Auto-increment to start from 0
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";

This will allow us to insert value zero in the auto incremental column which otherwise can only begin with atleast 1. This change should in no way affect the existing auto-incremental values.
That is, Auto increment value will start from 1 itself but we will be able to insert a record with 0 in the auto increment column.



1 comments:

Feeds Comments
SQL learning said...

How will I use PL/SQL?

Please give your valuable comments.