Delete query not working in mysql(删除查询在mysql中不起作用)
问题描述
我正在尝试从名为 user_enrole 的表中删除所有记录.我正在使用此查询
I am trying to delete all records from a table called user_enrole.I am using this query
DELETE * FROM user_enrole
我认为我的查询语法没有错,但它给了我错误说
I think syntax of my query is not wrong but it is giving me error saying
#1064 - 您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册以了解要使用的正确语法在第 1 行的* FROM user_enrole"附近
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* FROM user_enrole' at line 1
我已经仔细检查了我的语法,我无法弄清楚出了什么问题,请有人指出.
I have doubled check my syntax i am not able to figure out what is going wrong can someone point out please.
是因为这个表与使用表的关系还是什么?
Is it occuring because of the relationship this table has with use table or what?
推荐答案
您不需要在删除中使用星号.只需执行 DELETE FROM user_enrole
即可删除所有记录.
You don't need to use the asterisk in a delete. Just do DELETE FROM user_enrole
to delete all records.
如果你想删除由一个或多个条件过滤的特定记录,你将在WHERE
子句中指定这些条件,如下所示:
If you want to delete specific records filtered by one or more conditions, you will specify those conditions in the WHERE
clause, like so:
DELETE FROM user_enrole
WHERE somecolumn > 1
AND anothercolumn = 'Username'
这篇关于删除查询在mysql中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:删除查询在mysql中不起作用


- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- SQL 临时表问题 2022-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 更改自动增量起始编号? 2021-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01