Yes, the AUTO_INCREMENT in MySQL will be signed (Positive and Negative Value both) by default.
Let us first create a table −
mysql> create table DemoTable -> ( -> MyNumber int AUTO_INCREMENT PRIMARY KEY -> ); Query OK, 0 rows affected (0.45 sec)
Insert some records in the table using insert command. Here, we have set negative values as well for AUTO_INCREMENT column −
mysql> insert into DemoTable values() ; Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable values(-100); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable values(-300); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values(0); Query OK, 1 row affected (0.18 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
Output
+----------+ | MyNumber | +----------+ | -300 | | -100 | | 1 | | 2 | +----------+ 4 rows in set (0.00 sec)