I'm using Mathematica, and accessing mysql through mysql (Connector/J). When I try to update a field in my table using WHERE statement, all the rows get updated

SQLUpdate[conn2, "Table", {"pos"}, {"Value1"}, Equal[SQLColumn["word"], "Value2"]]

SQLSelect[conn2, "Recipe.OptOutWordInIngredient"]

I thought it had to do with not using SQLStringMatchQ.
However, when I use SQLStringMatchQ

SQLSelect[conn2, "Table", SQLStringMatchQ[DatabaseLink`SQLColumn["word"], "value"]]

I get the following error:

The value SQLStringMatchQ[acid ,value] cannot be converted to a value in an SQL statement.*

Any help will be appreciated

  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$
    – user9660
    Feb 18, 2015 at 15:58
  • 1
    $\begingroup$ Not an answer to your question, but a tip -- I use Mathematica and MySQL together every day, and I use SQLExecute[] rather than SQLUpdate[] or SQLSelect[]. This way I can test the SQL directly in the mySQL workbench and make sure it's doing what I want before I put in in Mathematica. $\endgroup$ Apr 15, 2016 at 21:21
  • $\begingroup$ @MichaelStern I do the same. I was/am very interested to go even further and systematically apply SQL to data massaging and retrieval tasks within Mathematica in the same way the R package "sqldf" does. $\endgroup$ May 15, 2016 at 14:42

1 Answer 1


Both these methods of updating work and produce the same results.

SQLUpdate[conn2, "Table", {"pos"}, {"Value1"},
   Equal[SQLColumn["word"], "Value2"]]

SQLUpdate[conn2, "Table", {"pos"}, {"Value1"},
   SQLStringMatchQ[SQLColumn["word"], "Value2"]]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.