
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
ERROR 1064 (42000): You have an error in your SQL syntax at zero fill column?
Following is the error and it occurs when you implement ZEROFILL incorrectly−
mysql> create table DemoTable -> ( -> StudentCode int(10) NOT NULL ZEROFILL AUTO_INCREMENT PRIMARY KEY -> ); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ZEROFILL AUTO_INCREMENT PRIMARY KEY )' at line 3
For correct implementation, use the below syntax −
Syntax
yourColumnName int(10) ZEROFILL NOT NULL AUTO_INCREMENT PRIMARY KEY
Let us first create a table −
mysql> create table DemoTable -> ( -> StudentCode int(10) ZEROFILL NOT NULL AUTO_INCREMENT PRIMARY KEY -> ); Query OK, 0 rows affected (0.55 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable values(); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable values(); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values(); Query OK, 1 row affected (0.28 sec) mysql> insert into DemoTable values(); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values(); Query OK, 1 row affected (0.10 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output −
+-------------+ | StudentCode | +-------------+ | 0000000001 | | 0000000002 | | 0000000003 | | 0000000004 | | 0000000005 | +-------------+ 5 rows in set (0.00 sec)
- Related Articles
- Resolve MySQL ERROR 1064 (42000): You have an error in your syntax?
- Fix MySQL Error #1064 - You have an error in your SQL syntax… near 'TYPE=MyISAM?
- Resolve usage of quotes ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use?
- How to resolve the MySQL error “You have an error in your SQL syntax; check the manual\nthat corresponds to your MySQL server version for the right syntax to use near?”
- Fix ERROR 1064 (42000) while creating a database in MySQL?
- How to fix error “You have an error in your syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near… ”?
- Fix MySQL ERROR 1064 (42000) check the manual that corresponds to your MySQL server version for the right syntax to use near ')'
- Resolve ERROR 1064 (42000) that occurred after using varchar (without providing the size)
- Fix MySQL Database Error #1064?
- Declare syntax error in MySQL Workbench?
- Fix Error in MySQL syntax while creating a table column with name “index”?
- Getting a syntax error unknown fields in SAP ABAP
- How to correctly use INSERT INTO … SELECT in MySQL to avoid Error 1064?
- Resolve Syntax error near “ORDER BY order DESC” in MySQL?
- How to resolve the ERROR 1115 (42000): Unknown character set: 'utf8mb4'?

Advertisements