为了账号安全,请及时绑定邮箱和手机立即绑定

mysql问题,关于语法

mysql问题,关于语法

qq_昼绽_0 2016-12-26 01:45:43
查看完整描述

4 回答

已采纳
?
EnzoLiu

TA贡献8条经验 获得超4个赞

explain处存在问题,这是mysql的一个关键字,所以提示错误了。

修正后:

create table scores (
`id` int not null primary key auto_increment,
`subject` varchar (50) not null,
`score` float not null,
`student_name` varchar(50) not null,
`explain` text not null
);


查看完整回答
反对 回复 2016-12-26
  • qq_昼绽_0
    qq_昼绽_0
    mysql> create table scores ( -> id int not null primary key auto_increment, -> subject varchar (50) not null -> ,score float not null, -> student_name varchar(50) not null, -> explain text not null, -> );
?
qq_昼绽_0

TA贡献82条经验 获得超17个赞

explain是关键字

加上反引号就可以通过了

查看完整回答
1 反对 回复 2016-12-26
?
qq_连环_04358155

TA贡献34条经验 获得超5个赞

explain是保留字啊亲!

explain显示了mysql如何使用索引来处理select语句以及连接表。可以帮助选择更好的索引和写出更优化的查询语句。

使用方法,在select语句前加上explain就可以了,如:

explain select * from statuses_status where id=11;


查看完整回答
反对 回复 2016-12-30
  • 4 回答
  • 0 关注
  • 1649 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信