-1
use tutorial;

CREATE TABLE people (
    'first' VARCHAR(100) NOT NULL,
    middle CHAR(1) NOT NULL,
    'last' VARCHAR(100) NOT NULL,
    sex VARCHAR(6) NOT NULL,
    birthday DATETIME NOT NULL,
    state CHAR(2) NOT NULL,
    PRIMARY KEY ( id )
    id INT NOT NULL AUTO_INCREMENT,

    );

//side note, I am extremely new, just trying to learn, and I came across this error and was unsure of how to fix it.

Ergest Basha
  • 7,870
  • 4
  • 8
  • 28

1 Answers1

1

In mysql, if you want to use reserved words as column names, you must enclose them in backticks, not single quotes. You also appear to have reversed the order of the id INT and PRIMARY KEY lines, leaving a comma missing and an extra comma.

CREATE TABLE people (
    `first` VARCHAR(100) NOT NULL,
    middle CHAR(1) NOT NULL,
    `last` VARCHAR(100) NOT NULL,
    sex VARCHAR(6) NOT NULL,
    birthday DATETIME NOT NULL,
    state CHAR(2) NOT NULL,
    id INT NOT NULL AUTO_INCREMENT,
    PRIMARY KEY ( id )

    );
ysth
  • 96,171
  • 6
  • 121
  • 214