Delete query not working in mysql

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 - 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?


You don't need to use the asterisk in a delete. Just do DELETE FROM user_enrole to delete all records.

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'

When you write SELECT * FROM... the * means everything, i.e. all fields. All parts of the row(s). It makes no sense to use the same syntax when deleting, because you can only delete entire rows. This is why the syntax is DELETE FROM...