0
点赞
收藏
分享

微信扫一扫

【mysql】delete from命令使用别名


【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后边


举报

相关推荐

0 条评论