索引和约束是否可以具有相同的名称以及推荐的命名约定
CREATE TABLE IF NOT EXISTS `mydb`.`books` (
`id` INT NOT NULL AUTO_INCREMENT ,
`isbn` VARCHAR(45) NOT NULL ,
`category_id` INT NOT NULL ,
`publisher_id` INT NOT NULL ,
`year` YEAR NULL ,
PRIMARY KEY (`id`) ,
INDEX `fk_books_category_id` (`category_id` ASC) ,
INDEX `fk_books_publisher_id` (`publisher_id` ASC) ,
CONSTRAINT `fk_books_category_id`
FOREIGN KEY (`category_id` )
REFERENCES `mydb`.`categories` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_books_publisher_id`
FOREIGN KEY (`publisher_id` )
REFERENCES `mydb`.`publishers` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;