热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

SQLite删除与表别名[重复]-SQLitedeletewithtablealias[duplicate]

Thisquestionalreadyhasananswerhere:这个问题在这里已有答案:Sqlitedeletequeryerror3answe

This question already has an answer here:

这个问题在这里已有答案:

  • Sqlite delete query error 3 answers
  • Sqlite删除查询错误3个答案

I am trying to alias a table in SQLite, for example by the following command: (it is from the book i am reading"Database Management Systems by Ramakrishnan")

我试图在SQLite中对表进行别名,例如通过以下命令:(它来自我正在阅读的书“Ramakrishnan的数据库管理系统”)

DELETE FROM Students S WHERE S.sid=12546

This code gives a syntax error. Without aliasing, the following code works:

此代码提供语法错误。如果没有别名,以下代码可以正常工作:

DELETE FROM Students WHERE sid=12546

But, if i want to alias the table, what should i do? Can anyone help?

但是,如果我想对表格进行别名,我该怎么办?有人可以帮忙吗?

Thanks

1 个解决方案

#1


3  

The DELETE statement operates on a single table and does not use a table alias. so you will have to use your query as :

DELETE语句在单个表上运行,不使用表别名。所以你必须使用你的查询:

DELETE FROM Students WHERE sid=12546

Update: SQLite apparently doesn't support joins with the delete statement, as you can see on the Syntax diagrams. In short in SQLite, one DELETE command deletes from only one table. So aliasing is of no use

更新:SQLite显然不支持与delete语句的连接,正如您在语法图中看到的那样。简而言之,在SQLite中,一个DELETE命令只从一个表中删除。所以别名是没用的


推荐阅读
author-avatar
蒋军利
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有