Krab
Krab

Reputation: 6756

Mysql table definition error

I am still getting error around the repeat column.

#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 'repeat TINYINT(1) NOT NULL DEFAULT 0, popis TEXT DEFAULT NULL, start DATE ' at line 4

CREATE TABLE akce (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
  nazev VARCHAR(255) NOT NULL,
  repeat TINYINT(1) NOT NULL DEFAULT 0,
  popis TEXT DEFAULT NULL,
  start DATE NOT NULL,
  end DATE NOT NULL
)ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_czech_ci;

Upvotes: 0

Views: 44

Answers (2)

Ravinder Reddy
Ravinder Reddy

Reputation: 23992

repeat, start, and end are reserved words. Always use back quotes( ` ), to surround them, to get them accepted.

Though some words are not mentioned in the reserved words table announced, it would be a better practice avoiding use of reserved words as data identifiers.

Refer To: MySQL Reserved Words

Upvotes: 0

ceejayoz
ceejayoz

Reputation: 179994

REPEAT is a MySQL reserved word. Surround it with ` marks to escape it, or rename the column.

Upvotes: 2

Related Questions