删除查询在MySQL中不起作用 [英] Delete query not working in mysql

查看:87
本文介绍了删除查询在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中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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