Let's say that I have a VARCHAR (which contains numeric data) that I want to use for a simple computation (adding 10 to it). According to the MySQL documentation on CAST functions, I could accomplish this with either a CAST or a CONVERT:

SELECT (CAST(field1 AS SIGNED)) + 10
FROM myTable;


FROM myTable;

What is the difference between CAST and CONVERT in this sense? Are they both really accomplishing the same thing?


Yes, CAST and CONVERT do the same thing, except that CONVERT allows more options, such as changing character set with USING.

  • 1
    Is there a kind of performance difference o something like that... i meant there's must be a difference.. – user7479 Mar 15 '12 at 22:48
  • 3
    cast is part of the SQL standard, while convert is not – a_horse_with_no_name Mar 1 '17 at 11:54

Convert and cast docs. Aside from the syntax I believe they can functionally be considered synonyms, even when trying to change character sets.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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