<>【mysql】delete from命令使用别名

我们平时使用delete from 进行删除数据库表中的数据

<>语法

* delete from table_name where [clause]
<>使用别名注意

*
但是我们会在使用别名的时候出现错误,在oracle中我们可以这样使用

* delete from table_name t where t.id = #{id}
*
但是这种写法在mysql中会报错,【you have an error in your sql

syntax;check the manual that corresponds to your mysql server version for the
right synatx to use near wher t.id = ‘id’】

*
那是因为在mysql中并不支持这种写法,如果使用别名的话,我们可以这样进行书写

* delete t from table_name t where t.id = #{id}
*
要多添加一个别名在delete后边

技术
下载桌面版
GitHub
百度网盘(提取码:draw)
Gitee
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:ixiaoyang8@qq.com
QQ群:766591547
关注微信