0
CREATE TABLE 'users' (
'id' int(11) unsigned NOT NULL AUTO_INCREMENT,
'name' varchar(75) NOT NULL,
'password' varchar(100) NOT NULL,
'email' varchar(100) NOT NULL,
PRIMARY KEY ('id'),
UNIQUE KEY 'email' ('email')
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1;

D

1

You shouldn't use quotes for the names of objects / entities, that stringifies it as a value instead. This would be the correct syntax you're looking for:

CREATE TABLE users
(
    id int(11) unsigned NOT NULL AUTO_INCREMENT, 
    name varchar(75) NOT NULL,
    password varchar(100) NOT NULL, 
    email varchar(100) NOT NULL, 
    PRIMARY KEY (id), 
    UNIQUE KEY email (email) 
) ENGINE=InnoDB DEFAULT CHARSET=utf8 
COLLATE=utf8_unicode_ci AUTO_INCREMENT=1;
3
  • Thank you for your fast response!
    – Xero Day
    Apr 4 at 0:58
  • 1
    Use backtics (`) around table and column names, at least when there is a conflict with reserved words.
    – Rick James
    Apr 4 at 1:13
  • @XeroDay Sure thing no problem! Please see Rick James' helpful comment as well. 🙂
    – J.D.
    Apr 4 at 1:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.