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

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

王林
Release: 2023-08-28 09:25:02
forward
1648 people have browsed it

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

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

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

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!

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