
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
AUTO_INCREMENT in MySQL can be signed by default?
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)
- Related Questions & Answers
- Alter a MySQL column to be AUTO_INCREMENT?
- How to order by auto_increment in MySQL?
- Can I find out the next auto_increment to be used?
- How can we change MySQL AUTO_INCREMENT starting number?
- Reset AUTO_INCREMENT in MySQL
- Is INNODB enabled by default in MySQL?
- How can I set a MySQL database to use MyISAM by default?
- MySQL AUTO_INCREMENT with Examples
- Can we insert records in a MySQL table without auto_increment values?
- Working with AUTO_INCREMENT Columns in MySQL
- Is there a default ORDER BY value in MySQL?
- How can we check that by default MySQL CHAR() function returns a binary string?
- Avoiding rewrite attributes with MySQL AUTO_INCREMENT
- How can we specify default values in MySQL INSERT statement?
- Can Google Chrome be supported by Selenium IDE?
Advertisements