SQLite 删除表别名 [英] SQLite delete with table alias

查看:41
本文介绍了SQLite 删除表别名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为 SQLite 中的表添加别名,例如通过以下命令:(它来自我正在阅读的书Ramakrishnan 的数据库管理系统")

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")

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?

谢谢

推荐答案

DELETE 语句对单个表进行操作,并且不使用表别名.所以你必须使用你的查询:

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 FROM Students WHERE sid=12546

更新:SQLite 显然不支持与删除语句的连接,正如您在 语法图.简而言之,在 SQLite 中,一个 DELETE 命令只能从一张表中删除.所以混叠是没有用的

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 删除表别名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆