If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > What is size in tinyint(size)

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-04-11, 04:04
rohitamitpathak rohitamitpathak is offline
Registered User
 
Join Date: Feb 2011
Location: india- new delhi
Posts: 31
What is size in tinyint(size)

I m new in mysql, i want to know what is size in tinyint(size)
---> i know tiny int require one byte and can handle -128 to 127
what happen when we write tinyint(1) or tinyint(4)
Reply With Quote
  #2 (permalink)  
Old 03-04-11, 04:39
it-iss.com it-iss.com is offline
Registered User
 
Join Date: Sep 2009
Location: San Sebastian, Spain
Posts: 623
TINYINT uses as you mention yourself a single byte of storage. In SIGNED mode this represents -128 to 127 and UNSIGNED 0 to 255. However, using TINYINT(1) does not alter the storage capacity used in the database.

The display width (1 in TINYINT(1)) does not constrain the range of values that are stored in the column.

Here is an extract from the MySQL manual:

Quote:
The display width does not constrain the range of values that can be stored in the column. Nor does it prevent values wider than the column display width from being displayed correctly. For example, a column specified as SMALLINT(3) has the usual SMALLINT range of -32768 to 32767, and values outside the range permitted by three digits are displayed in full using more than three digits.
__________________
Ronan Cashell
Senior Oracle/MySQL DBA
http://www.it-iss.com
Reply With Quote
Reply

Tags
mysql data-type

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On