1

Does the INT, TINYINT, MEDIUMINT, BIGINT in MySQL Accepts the character '-' ? I used the data type INT in a column and the data inside has the character '-'. And somehow it didn't accept it. If it's not possible for INT data types, should I use VARCHAR?

3 Answers 3

1

The values for an integer in SQL are:

-2147483648 through 2147483647

And the byte size is 4 bytes.

Other maximum values:

BigInt: -9223372036854775808 through 9223372036854775807 (8 bytes)
SmallInt: -32768 through 32767 (2 bytes)
TinyInt: 0 through 255 (1 byte)

it dosent accept any char or string values like "-"

use varchar datatype if u want to insert "-"

Sign up to request clarification or add additional context in comments.

Comments

1

Use VARCHAR(45) or TEXT datatype, if you want to insert characters.

Comments

1

you have to use Varchar DataType for this.

It will support both Int and Special Symbol like '-'

If you are not going to do any arithmetic operaion means then you can use Varchar or text DataType

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.