user2596311
user2596311

Reputation: 1

Weird MySQL syntax error with simple CREATE TABLE statement

Error:

#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 '‘00000000000’ membership_status ENUM(‘gold’,‘silver’,‘bronze’,' at line 5

SQL:

CREATE TABLE members(
member_id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
name VARCHAR(60)NOT NULL,
birthday DATE NOT NULL,
phone CHAR(10)NOT NULL DEFAULT ‘00000000000’,
membership_status ENUM(‘gold’,‘silver’,‘bronze’,‘nam’)NOT NULL DEFAULT ‘nam’,
PRIMARY KEY(member_id)    
)   

Upvotes: 0

Views: 314

Answers (3)

Cuespeak
Cuespeak

Reputation: 169

try this

CREATE TABLE members(
  member_id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
  name VARCHAR(60)NOT NULL,
  birthday DATE NOT NULL,
  phone CHAR(10)NOT NULL DEFAULT '0000000000',
  membership_status ENUM('gold','silver','bronze','nam')NOT NULL DEFAULT 'nam',
  PRIMARY KEY(member_id)    
)

I changed the single quotes to plain ' and your default value for phone was also 1 to many 0s

Upvotes: 1

Kneel-Before-ZOD
Kneel-Before-ZOD

Reputation: 4221

The single quotes used are not recognized by the database server. Replace those fancy quotes with the regular one ' and you will be okay.
Note that you'll encounter problems in other programs as long as you use that kind of quotes as they are not the proper quotes to be used.

Hope this helps.

Upvotes: 0

Novocaine
Novocaine

Reputation: 4786

I'd guess it was the funky single quotes you're trying to use. Try this with standard ' single quotes

CREATE TABLE members(
    member_id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
    name VARCHAR(60)NOT NULL,
    birthday DATE NOT NULL,
    phone CHAR(10)NOT NULL DEFAULT '00000000000',
    membership_status ENUM('gold','silver','bronze','nam') NOT NULL DEFAULT 'nam',
    PRIMARY KEY(member_id)
)

Upvotes: 2

Related Questions