Question

  • Creator
    Topic
  • #2213733

    MySQL INT data type

    Locked

    by sumitha mani ·

    Hi,

    I have started working in MySQL recently. I tried to import an excel into mysql table. everything is fine but for one column. I have defined a column called ‘telephone_no’ with int(30) as datatype. the data in the table after importing is absurd for a few records.. rest of the records seem fine. Dont know what is wrong. for example, i tried to insert the number ‘2825861214’ but i get this number ‘2147483647’.. Please could anyone tell me what the problem and solution is ?

    thank you

All Answers

  • Author
    Replies
    • #2868779

      Clarifications

      by sumitha mani ·

      In reply to MySQL INT data type

      Clarifications

    • #2868778

      Thanks !

      by sumitha mani ·

      In reply to MySQL INT data type

      I should have used BIGINT. thanks

      • #2870776

        Be careful with that size stuff

        by tony hopkinson ·

        In reply to Thanks !

        30 is the number of characters the value can take up in a fixed width field of the file.

        BigInt (signed by default) takes up a maximum of 19 digits, unsigned it’s 21 (I think) so you are allocating space that can never be used for the underlying data type. Character data type with a format specifier for input is better for telephone numbers anyway.

Viewing 1 reply thread