在idea里运行自己写的学生表sql脚本,为什么为失败?
文件是以.sql结尾
错误提示:
[2021-05-30 15:59:24] Connecting to @localhost...
[2021-05-30 15:59:24] Using batch mode (1000 insert/update/delete statements max)
[2021-05-30 15:59:24] Run C:\Users\User\Desktop\MyBatis源代码\Student.sql
CREATE TABLE student(
id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
reg_no int NOT NULL,
name VARCHAR(20) NOT NULL,
sex VARCHAR(20),
age int NOT NULL,
grade VARCHAR(20) NOT NULL,
major VARCHAR(50) NOT NULL
)
[2021-05-30 15:59:24] [3D000][1046] No database selected
INSERT INTO student values (null,20171201,"梅长苏","男",31,"2008","哲学系")
.
[2021-05-30 15:59:24] [3D000][1046] No database selected
[2021-05-30 15:59:24] Summary: 8 of 8 statements executed, 8 failed in 14 ms (683 symbols in file)
sql文件代码:
CREATE TABLE student(
id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
reg_no int NOT NULL,
name VARCHAR(20) NOT NULL,
sex VARCHAR(20),
age int NOT NULL,
grade VARCHAR(20) NOT NULL,
major VARCHAR(50) NOT NULL
);
INSERT INTO student values (null,20171201,"梅长苏","男",31,"2008","哲学系");
INSERT INTO student values (null,20171202,"小明","男",30,"2008","政治系");
INSERT INTO student values (null,20171203,"kate","女",31,"2016","人体系");
INSERT INTO student values (null,20171204,"yap","男",31,"2008","体育系");
INSERT INTO student values (null,20171205,"Dan","男",31,"2008","哲学系");
INSERT INTO student values (null,20171206,"Tom","男",31,"2008","哲学系");
INSERT INTO student values (null,20171207,"Jack","男",31,"2008","通信专业");
正在回答 回答被采纳积分+1
- 参与学习 人
- 提交作业 9393 份
- 解答问题 16556 个
综合就业常年第一,编程排行常年霸榜,无需脱产即可学习,北上广深月薪过万 无论你是未就业的学生还是想转行的在职人员,不需要基础,只要你有梦想,想高薪
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星