Search code examples
mysqldatabasecreate-table

Error 1064 at line 6 while creating sql table


CREATE TABLE Customer(
customer_id INT AUTO_INCREMENT PRIMARY KEY,
customer_name VARCHAR(50) NOT NULL,
customer_email VARCHAR(100) NULL,
street_address VARCHAR(50) NULL,
city VARCHAR(50) NULL,
province CHAR(2) NULL,
postal_code CHAR(6) NULL,
);

As said above I get error 1064 when attempting to create a new table and am not sure why. The name "city" isn't a reserved word, and the definitions aren't depreciated to my knowledge

#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 ')' at line 6


Solution

  • remove last comma after postal_code

    CREATE TABLE Customer(
    customer_id INT AUTO_INCREMENT PRIMARY KEY,
    customer_name VARCHAR(50) NOT NULL,
    customer_email VARCHAR(100) NULL,
    street_address VARCHAR(50) NULL,
    city VARCHAR(50) NULL,
    province CHAR(2) NULL,
    postal_code CHAR(6) NULL
    );