Hope that if you get MySQL error 1064 on your machine, this user guide will help you solve it. ERROR 1064 (42000) mainly occurs when the syntax is set incorrectly, i.e. an error using the backtick character or creating a database without it can also cause an error if you use a hyphen in the name, for example B. Demo Table results in ERROR 1064 (42000). The database has been successfully created.
Here are the problems I see in your original script:
TEXTmust not have any
TINYTEXTis the same as
VARCHAR (255), so you cannot specify a maximum length for the
TINYTEXTfield as it is already implied.
A space is required between
PRIMARYKEY. It should be
In the end, this is not a problem, but in your first
CREATE TABLEstatement, you have an odd spacing. If you change the
ClientEmailline as follows, it becomes more readable:
ClientPhone CHAR (10) NOT EMPTY,ClientEmail TINYTEXT NON NULL,
See the MySQL documentation for more information. After all these fixes, here are the working MySQL queries:
CREATE DATABASE bankbase;USE the bank; CREATE TABLE customer table (ClientID SMALLINT (15) NOT NULL DEFAULT 0,ClientFirstName VARCHAR (30) NOT NULL DEFAULT "Name",ClientLastName VARCHAR (30) NOT NULL DEFAULT "Last name",ClientPhone CHAR (10) NOT NULL,ClientEmail TINYTEXT NULL,ClientAddress TINYTEXT NON NULL,PRIMARY KEY (ClientID));CREATE branch table (BranchID SMALLINT (15) NOT NULL P DEFAULT 0,BranchCity TINYTEXT NON NULL,BranchManagerFName VARCHAR (30) NULL DEFAULT "Branch manager name",BranchManagerLName VARCHAR (30) NULL DEFAULT "LAst Name of Branch Manager",BranchPhone CHAR (10) NOT NULL,BranchEmail TINYTEXT NULL,PRIMARY KEY (BranchID)); CREATE TABLE transaction table (TypeID SMALLINT (15) NOT NULL DEFAULT 0,Enter ENUM ('CHECK', 'SAVE') NON NULL.TransAmount DECIMAL NON NULL,TransDate TIMESTAMP NOT NULL,DOUBLE NOT ZERO balance,Primary key (TypeID));
If you hit
create schema on this SQL script, you will find that it works!
Causes Of Error 1064
This may sound cryptic as it is a general error indicating a syntax problem in an SQL query statement. Since error 1064 can have several causes, we will look at the most common causes that lead to this error and show you how to fix them. Follow the instructions to keep your SQL queries updated and run correctly.
How To Fix MySQL Error 1064 (5 Methods)
If you already know what is causing the MySQL 1064 error, you can simply skip to the solution for your specific situation. However, if you do not know why the error occurred, askTry the simplest solution first.
In this case, we recommend that you test the five most likely fixes in the following order.