CREATE TABLE `admin` ( `admin_id` int(11) NOT NULL AUTO_INCREMENT, `admin_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `admin_number` int(11) NOT NULL, PRIMARY KEY (`admin_id`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; insert into `admin`(`admin_id`,`admin_name`,`admin_password`) values (1,'zxc','123',),(2,'qwe','123',);这段语句有什么错误
时间: 2023-10-21 14:03:41 浏览: 146
详解Mysql基础语法的使用
这段语句有两个错误:
1. `admin_number` 字段在 CREATE TABLE 语句中被定义,但在 INSERT INTO 语句中没有被插入值,这会导致插入失败。你可能想要将它更改为 `admin_password` 字段。
2. 在 INSERT INTO 语句中,最后一个插入值后面有一个额外的逗号,这会导致插入失败。你需要将 `(1,'zxc','123',)` 和 `(2,'qwe','123',)` 中的逗号删除。
下面是修改后的语句:
```
CREATE TABLE `admin` (
`admin_id` int(11) NOT NULL AUTO_INCREMENT,
`admin_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`admin_password` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
PRIMARY KEY (`admin_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
INSERT INTO `admin`(`admin_id`, `admin_name`, `admin_password`)
VALUES (1, 'zxc', '123'), (2, 'qwe', '123');
```
阅读全文