Home >Database >Mysql Tutorial >Resolving MySQL ERROR 1064 (42000): Is your syntax wrong?

Resolving MySQL ERROR 1064 (42000): Is your syntax wrong?

王林
王林forward
2023-08-28 09:25:021653browse

解决 MySQL ERROR 1064 (42000): 你的语法有错误?

This error occurs if you use var_char instead of the varchar type. To eliminate this type of error, use varchar(100) instead of var_char(100).

Now let us see how this error occurs -

mysql> create table removeErrorDemo
   -> (
   -> StudentId int,
   -> StudentName var_char(50)
   -> );

Below is the output showing the 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 'var_char(50)
)' at line 4

Now let us eliminate the error. Below is the query to remove error 1064 (42000) -

mysql> create table removeErrorDemo
   -> (
   -> StudentId int,
   -> StudentName varchar(100)
   -> );
Query OK, 0 rows affected (1.72 sec)

Above we have set the varchar correctly so no error will occur.

The above is the detailed content of Resolving MySQL ERROR 1064 (42000): Is your syntax wrong?. 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