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

Fix MySQL database error #1064?

王林
Release: 2023-08-28 18:45:06
forward
1400 people have browsed it

修复 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,
   );
Copy after login

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
Copy after login

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)
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template