SQLite删除与表别名[重复]

时间:2021-08-30 22:29:57

This question already has an answer here:

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

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命令只从一个表中删除。所以别名是没用的

#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命令只从一个表中删除。所以别名是没用的