MySQL 错误编号。 1064
MySQL Error Number. 1064
CREATE TABLE `smdonation`, `SM_USERLOGIN` {
`SM_ID` INTEGER NOT NULL DEFAULT,
`SM_USERNAME` VARCHAR(15) NOT NULL DEFAULT '',
`SM_PASSWORD` VARCHAR(20) NOT NULL DEFAULT '',
`SM_NAME` VARCHAR (50) NOT NULL DEFAULT '',
`SM_AGE` INTEGER NOT NULL DEFAULT,
`SM_EMAI`L VARCHAR(50) NOT NULL DEFAULT '',
PRIMARY KEY(SM_ID)
} ENGINE = InnoDB;
尝试创建上述 table 时,出现以下错误:
MySQL Error Number. 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 syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' SM_USERNAME
VARCHAR(15) NOT NULL DEFAULT ", SM_PASSWORD
VARCHAR(20)' a line 2
最初我尝试使用 TYPE=InnoDB
失败,所以在互联网上搜索并替换为 ENGINE=InnoDB
以创建 table,但错误仍然存在。
截图错误:
3 个代码中的问题:
- 您错过了整数的默认值
- Table创作不应该里面有逗号,应该是
schemaname.tablename
- Table 创建应包含括号
(
而不是 {
所以你的工作代码是:
CREATE TABLE `smdonation`.`SM_USERLOGIN` (
`SM_ID` INTEGER NOT NULL DEFAULT 0,
`SM_USERNAME` VARCHAR(15) NOT NULL DEFAULT '',
`SM_PASSWORD` VARCHAR(20) NOT NULL DEFAULT '',
`SM_NAME` VARCHAR (50) NOT NULL DEFAULT '',
`SM_AGE` INTEGER NOT NULL DEFAULT 0,
`SM_EMAIL` VARCHAR(50) NOT NULL DEFAULT '',
PRIMARY KEY(SM_ID)
) ENGINE = InnoDB;
CREATE TABLE `smdonation`, `SM_USERLOGIN` {
`SM_ID` INTEGER NOT NULL DEFAULT,
`SM_USERNAME` VARCHAR(15) NOT NULL DEFAULT '',
`SM_PASSWORD` VARCHAR(20) NOT NULL DEFAULT '',
`SM_NAME` VARCHAR (50) NOT NULL DEFAULT '',
`SM_AGE` INTEGER NOT NULL DEFAULT,
`SM_EMAI`L VARCHAR(50) NOT NULL DEFAULT '',
PRIMARY KEY(SM_ID)
} ENGINE = InnoDB;
尝试创建上述 table 时,出现以下错误:
MySQL Error Number. 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 syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '
SM_USERNAME
VARCHAR(15) NOT NULL DEFAULT ",SM_PASSWORD
VARCHAR(20)' a line 2
最初我尝试使用 TYPE=InnoDB
失败,所以在互联网上搜索并替换为 ENGINE=InnoDB
以创建 table,但错误仍然存在。
截图错误:
3 个代码中的问题:
- 您错过了整数的默认值
- Table创作不应该里面有逗号,应该是
schemaname.tablename
- Table 创建应包含括号
(
而不是{
所以你的工作代码是:
CREATE TABLE `smdonation`.`SM_USERLOGIN` (
`SM_ID` INTEGER NOT NULL DEFAULT 0,
`SM_USERNAME` VARCHAR(15) NOT NULL DEFAULT '',
`SM_PASSWORD` VARCHAR(20) NOT NULL DEFAULT '',
`SM_NAME` VARCHAR (50) NOT NULL DEFAULT '',
`SM_AGE` INTEGER NOT NULL DEFAULT 0,
`SM_EMAIL` VARCHAR(50) NOT NULL DEFAULT '',
PRIMARY KEY(SM_ID)
) ENGINE = InnoDB;