Question :
Let’s say I have table name Company with two columns cname, location.
In the table I am having two records with
cname |location
Asmetric |Dallas
Sophore |Washington
on this table when I perform a delete operation
delete company where cname='Sophore';
I am getting an error
Error 1064:You have an error in sql syntax check the manual that corresponds to your sql server version
whereas i had expected the complete record to be deleted , is the syntax wrong or it’s incomplete.Any suggestions welcome
Answer :
Your error output is strange, it should be:
ERROR 1064 (42000): 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 'where cname='Sophore'' at line 1
Which tell you exactly where the error is- you forgot the FROM
clause on DELETE:
DELETE FROM company WHERE cname='Sophore';