Ivan Ivan - 5 months ago 20
MySQL Question

SQL Query Create Table Error

I got this error message:


#1064 - 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 'NOT NULL,

full_name varchar,

first_name varchar,

last_name varchar,

email va' at line 2


create table ABC_CAFE(
fb_id varchar NOT NULL,
full_name varchar,
first_name varchar,
last_name varchar,
email varchar,
gender varchar,
age_range varchar,
link varchar,
locale varchar,
updated_time varchar,
timezone varchar,
verified varchar,
url varchar,
date_time varchar NOT NULL,
device varchar,
device_brand varchar,
operating_system varchar,
browser_name varchar,
CONSTRAINT ID_DATE_TIME_KEY PRIMARY KEY (fb_id,date_time)
);

Answer

Provide column size for the varchar like varchar(50)

Working SQL fiddle after adding the column size: http://sqlfiddle.com/#!9/a06419


Edit:

For sample I added varchar(50), you can increase/reduce the column size according to each column's requirement.

Comments