Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/57.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
mysql表创建错误#1089_Mysql_Sql - Fatal编程技术网

mysql表创建错误#1089

mysql表创建错误#1089,mysql,sql,Mysql,Sql,我们想在mysql数据库中创建一个表,但它不能正常工作 错误消息显示: #1089-前缀键不正确;使用的密钥部分不是字符串,使用的长度比密钥部分长,或者存储引擎不支持唯一前缀密钥 代码如下: CREATE TABLE `student_billing`.`payment` ( `id` INT(10) NOT NULL AUTO_INCREMENT , `student_name` INT(255) NOT NULL , `student_roll` INT(255) NOT NULL , `s

我们想在mysql数据库中创建一个表,但它不能正常工作

错误消息显示:

#1089-前缀键不正确;使用的密钥部分不是字符串,使用的长度比密钥部分长,或者存储引擎不支持唯一前缀密钥

代码如下:

CREATE TABLE `student_billing`.`payment` (
`id` INT(10) NOT NULL AUTO_INCREMENT ,
`student_name` INT(255) NOT NULL ,
`student_roll` INT(255) NOT NULL ,
`student_batch_id` INT(255) NOT NULL ,
`student_course_name` INT(255) NOT NULL ,
`student_paid_ammount` INT(255) NOT NULL ,
`student_paid_date` DATETIME(6) NOT NULL , 
`student_payment_recivedby` INT(255) NULL ,
 PRIMARY KEY (`id`(10))) ENGINE = MyISAM COMMENT = 'Students Billing DB';

在声明主键时,不需要指定字段的长度。请尝试以下方法:

CREATE TABLE `student_billing`.`payment` (
  `id` INT(10) NOT NULL AUTO_INCREMENT,
  `student_name` INT(255) NOT NULL,
  `student_roll` INT(255) NOT NULL,
  `student_batch_id` INT(255) NOT NULL,
  `student_course_name` INT(255) NOT NULL,
  `student_paid_ammount` INT(255) NOT NULL,
  `student_paid_date` DATETIME(6) NOT NULL,
  `student_payment_recivedby` INT(255) NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM COMMENT='Students Billing DB';
/DDL信息/
永远记得先谷歌!通过谷歌搜索错误消息显示,例如,这可能已经是问题的解决方案:
CREATE TABLE `payment` (
  `id` INT(10) NOT NULL AUTO_INCREMENT,
  `student_name` INT(255) NOT NULL,
  `student_roll` INT(255) NOT NULL,
  `student_batch_id` INT(255) NOT NULL,
  `student_course_name` INT(255) NOT NULL,
  `student_paid_ammount` INT(255) NOT NULL,
  `student_paid_date` DATETIME NOT NULL,
  `student_payment_recivedby` INT(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MYISAM DEFAULT CHARSET=latin1 COMMENT='Students Billing DB'