littleswany littleswany - 1 month ago 21
SQL Question

MySQL Database Error #1064

I was trying to create a users table in MySQL.
I got the error message 1064. Here is the command I entered.

CREATE TABLE Users(
Usrid INT unsigned auto_increment PRIMARY KEY not null,
Username varchar(20),
Name varchar(25),
Surname varchar(25),
Email varchar(50),
Password varchar(50),
);


Any help would be greatly appreciated!

Answer

Get rid of the comma after your last column definition:

CREATE TABLE Users(
  Usrid INT unsigned auto_increment PRIMARY KEY not null,
  Username varchar(20),
  Name varchar(25),
  Surname varchar(25),
  Email varchar(50),
  Password varchar(50), <-- HERE
);

It should be

CREATE TABLE Users(
  Usrid INT unsigned auto_increment PRIMARY KEY not null,
  Username varchar(20),
  Name varchar(25),
  Surname varchar(25),
  Email varchar(50),
  Password varchar(50)
);
Comments