1
Peekay
MySQL TINYINT display width - 3 or 4?
  • 2006/12/2 22:03

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


Tinkering with MySQL and have a question.

If the unsigned range of TINYINT is -128 to 127, should the display width be TINYINT(3) or TINYINT(4)?

Basically, I'm trying to find out if the minus sign needs to be accounted for.

Any advice from DB experts would be welcomed!
A thread is for life. Not just for Christmas.

2
Peekay
Re: MySQL TINYINT display width - 3 or 4?
  • 2006/12/5 11:09

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


Four things have been revealed:

1) I got it wrong in the above post. The SIGNED range of TINYINT is -128 to 127.

2) SIGNED (or not specified) the default width is (4).
The minus sign does need to be accounted for.

3) UNSIGNED the range is 0 to 255.
As only 3 digits are used the default width is (3).

4) In PHPMyAdmin, if you leave the width field empty for numeric data, it enters the MySQL default for the data type automatically.

Doh!
A thread is for life. Not just for Christmas.

Login

Who's Online

403 user(s) are online (269 user(s) are browsing Support Forums)


Members: 0


Guests: 403


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits