简体   繁体   中英

Error when trying to create a table in mySQL

I am new to mysql and I was trying to create a basic table but I am getting one error that I can't figure out.

Heres the create table statement that I wrote

CREATE TABLE user (user_id varchar(50), name varchar(50), Yelping_since date, PRIMARY KEY(user_id);

heres the error that i get

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 
'' at line 1

你只是错过了一个结束括号

CREATE TABLE user (user_id varchar(50), name varchar(50), Yelping_since date, PRIMARY KEY(user_id));

尝试在分号末尾添加“)”。

应该像这个dawg

 CREATE TABLE user (user_id varchar(50), name varchar(50), Yelping_since date, PRIMARY KEY(user_id)) 

Make sure you started mysql as root.

EDIT: try this instead:

CREATE TABLE user (user_id int NOT NULL, name varchar(50), Yelping_since date, PRIMARY KEY(user_id));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM