简体   繁体   中英

MySQL Beginner - PHPMyAdmin always throw an error, can't find why

I am a complete beginner with MySQl. I used wwwsqldesigner to make a schema of my database. I'd like to put the script inside PHPmyAdmin but it always throws me an error, and it is in the beginning of the generated script from wwwsqldesigner. I just copied the first part of the query

 CREATE TABLE `ugl_users_events` (
  `id` INTEGER NOT NULL AUTO_INCREMENT DEFAULT NULL,
  `user_id` INTEGER NULL DEFAULT NULL,
  `event_id` INTEGER NULL DEFAULT NULL,
  `game_id` INTEGER NULL DEFAULT NULL,
  `creator` INTEGER NULL DEFAULT NULL,
  `creation_date` DATETIME NULL DEFAULT NULL,
  `last_modificator` INTEGER NULL DEFAULT NULL,
  `last_modification_date` DATETIME NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY ()
);

Where is the error ?

You have a useless empty unique key clause. Remove it and you should be OK.

CREATE TABLE `ugl_users_events` (
  `id` INTEGER NOT NULL AUTO_INCREMENT DEFAULT NULL,
  `user_id` INTEGER NULL DEFAULT NULL,
  `event_id` INTEGER NULL DEFAULT NULL,
  `game_id` INTEGER NULL DEFAULT NULL,
  `creator` INTEGER NULL DEFAULT NULL,
  `creation_date` DATETIME NULL DEFAULT NULL,
  `last_modificator` INTEGER NULL DEFAULT NULL,
  `last_modification_date` DATETIME NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
  -- clause removed, together with the comma before it
);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM