I know it might sound silly, I have to look up MySQL manual reference and another MySQL forum. as I could not find what is right datatype for numbers with '-' e.g


I'm not sure this number datatype like TINYINT, SMALLINT, MEDIUMINT INT and BIGINT will not working on this. I'm not sure if varchar is a right choice for this.

So Any Suggest what is the right choice for this before I build a new table and Data await to upload it.

  • 1
    yes, This "part" will be used together as not separate. this function might be useful for data record in some stage later but not now Feb 9, 2018 at 16:30

1 Answer 1


With hyphens, it's a string, full stop!

You could store it as a BIGINT (without the hyphens) and format it using the hyphens on the client side - putting hyphens at 4 and 12.

However, if the position of the hyphens varies, you'll have to store it as a string and not any form of number.

You should only store values as numbers if you're going to add/subtract/multiply or divide them - otherwise, they are strings and not "numbers" anyway! How do you perform mathematical operations with "numbers" which have hyphens?

  • Thanks for your help, I was not sure what it called, it was hyphens. Feb 9, 2018 at 14:38
  • Can also be called "dashes" - depending on where you're from - "dash" might be more North American.
    – Vérace
    Feb 9, 2018 at 14:53
  • Yes, I was going said dash but I am not sure if it's correct one! so i decided to put '-' rather than dashes Feb 9, 2018 at 15:23
  • Here's a deadly image which illustrates the point about mathematical operations :-)
    – Vérace
    Feb 9, 2018 at 15:28

Your Answer

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

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