r/mysql • u/Mindgoblinon • Mar 28 '25
solved MySQL Workbench finnicky?
I'm new to SQL using MySQL Workbench server version 8.0.41 and learning, so bear with me if this is silly, but why do I always have a hard time doing very simple table manipulation commands? Such as trying to delete a row:
DELETE FROM countrylanguage
WHERE 'CountryCode' = 'ABW' ;
The table is in fact named 'countrylanguage', and there is a column titled 'CountryCode' and a row(s) containing ABW. This isn't the only time that a seemingly simple manipulation throws (mostly syntax) codes no matter how I try to type it out. I've tried other WHERE statements with matching values and those don't work either. I'd prefer to learn the SQL syntax for this problem rather than a menu shortcut for these things as I'm learning for school.
5
u/feedmesomedata Mar 28 '25
I would suggest to use the mysql command line client as opposed to using MySQL Workbench. WB is not actively developed and is buggy imo, just check the number of posts related to it in this subreddit.
5
u/snookerfactory Mar 28 '25
What kind of quotes are those on CountryCode? If they're single quotes, then you're comparing the string "CountryCode" to "ABW" so your statement becomes DELETE FROM countrylanguage where False.
Leave the column name unquoted or use backticks.
3
u/Outdoor_Releaf Mar 28 '25 edited Mar 28 '25
Some tips that might help you.
SET SQL_SAFE_UPDATES = 0;You can then turn safe update mode on by setting it to 1.
Edit: Added last line. Removed odd characters that appeared at the end.
1
u/Mindgoblinon Mar 28 '25
Thanks to everybody for the help, what ended up working was disabling safe update and this specific statement, nothing else that I tried from numerous attempts including no quotes and just about every combo besides this one possible.
DELETE FROM `countrylanguages`.`countrylanguage`
My schema is bold in the navigator so I assume that it is selected but I still had to explicitly state the schema and table I wanted to work with.
1
u/jimmy66wins Mar 28 '25
Put the statement into ChatGPT, it will show you your syntax errors
1
u/tr0ngeek Mar 28 '25
Why is quotes in the column name?
2
u/saintpetejackboy Mar 28 '25
Is the table name possible case sensitive and was created with a capitalization somewhere?
You can turn a setting on that allows using mixed case table names but iirc some environments enable or disable this and/or versions.
Outside of that, make sure you are connected to the right database - maybe you are in a database that doesn't have that table. Do some basic select queries and make sure you can select the data you want to delete, first.