USE `sys`; DROP TABLE IF EXISTS `admin`; 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(50) CHARACTER SET utf8 COLLATE utf8_bin 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','abc'),(2,'qwe','acc'); DROP TABLE IF EXISTS `user`; CREATE TABLE `user` ( `user_id` int(11) NOT NULL AUTO_INCREMENT, `user_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `user_password` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, PRIMARY KEY (`user_id`) USING BTREE, ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;这段语句的错误
时间: 2023-09-28 20:05:57 浏览: 169
C++编程中__if_exists与__if_not_exists语句的用法
这段语句有一个错误,就是在创建`user`表的语句中,最后有一个逗号,导致语法错误。正确的语句应该是:
```
USE `sys`;
DROP TABLE IF EXISTS `admin`;
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(50) CHARACTER SET utf8 COLLATE utf8_bin 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', 'abc'), (2, 'qwe', 'acc');
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`user_id` int(11) NOT NULL AUTO_INCREMENT,
`user_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`user_password` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`user_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
```
阅读全文