Home >Database >Mysql Tutorial >Fix MySQL database error #1064?

Fix MySQL database error #1064?

王林
王林forward
2023-08-28 18:45:061375browse

修复 MySQL 数据库错误 #1064?

Database error #1064 may occur due to incorrect syntax. For example, suppose we are creating the following table -

mysql> create table DemoTable
   (
      UserId int NOT NULL AUTO_INCREMENT PRIMARY KEY,
      UserName varchar(100),
      UserAge int,
      UserAddress varchar(200),
      UserCountryName varchar(100) ,
      isMarried boolean,
   );

This will produce the following output i.e. error -

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 ')' at line 10

To remove the above error you need to remove the last comma (,). Query as below to eliminate the error -

mysql> create table DemoTable
   (
      UserId int NOT NULL AUTO_INCREMENT PRIMARY KEY,
      UserName varchar(100),
      UserAge int,
      UserAddress varchar(200),
      UserCountryName varchar(100),
      isMarried boolean
   );
Query OK, 0 rows affected (1.04 sec)

The above is the detailed content of Fix MySQL database error #1064?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete