When creating a table in mysql query I get the error as below.
x
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 'String,
last_name String,
email_address String
)' at line 4
I could not understand what is causing this error. The query is as below.
CREATE TABLE employees
(
id long,
first_name String,
last_name String,
email_address String
);
Advertisement
Answer
You appear to be using Java types in your create table statement. Try using proper MySQL types and it should work:
CREATE TABLE employees (
id INT AUTO_INCREMENT PRIMARY KEY,
first_name VARCHAR(55) NOT NULL,
last_name VARCHAR(55) NOT NULL,
email_address VARCHAR(255) NOT NULL
);