473,480 Members | 1,807 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

tinyint(3) smallint(5), mediumint(7) int(10) bigint(15)

bilibytes
128 New Member
tinyint(3) smallint(5), mediumint(7) int(10) bigint(15)

what are the nubers refering to?

bits or bytes?

that is to say:

tinyint(3) means i can store a number between ( 0 and 7 ) or (0 and 1677721) ??


cheers
May 25 '09 #1
6 31884
chazzy69
196 New Member
not 100% sure but i think number in the bracket (X) is refer to how many digits long your integer can be.

i.e. integer (7) you could have a integer with 7 digits

=> 1234567
May 25 '09 #2
bilibytes
128 New Member
@chazzy69
I'm almost sure that the numbers are represented in binary, i won't put my hand on fire but it think that the answer lies between my two propositions. And having done the calculation i think that the numbers refer to bytes.

if it were bits:
the maximum number allowed would be bigint(15) = 111111111111111 = 65,535
and that is not much..

however being bytes:
the maximum number would be : enormous!!

that said if my deduction is right, i have been wasting a lot of space when declaring my tables with bigint(15)...

if you can confirm that your statement is true, please let me know.
May 25 '09 #3
chazzy69
196 New Member
Oh hi again well for my mysql database (using phpmyadmin to manage) the number in the brackets defines length as number of chars so if i you set int(3) then try to save a 5 digit number it will take the first 3 digits and truncate the rest.

This is something you have to be careful of if you are storing strings within your database otherwise you will start loosing data if its not long enough.

Mabye different for yours, good luck :)
May 25 '09 #4
bilibytes
128 New Member
hi,
i have found an article that may clarify a little.
by the way, it's amazing when you type bigint(15) in google, this post pops out! i don't know which to congrat, google or bytes but if it's bytes I'm astonished.

cheers
May 26 '09 #5
chazzy69
196 New Member
Ah nice it only affects the display width, strangely still seems to affect php when it trys to read a value from mysql it will normally end up being to short.

Good explanation though
May 26 '09 #6
Atli
5,058 Recognized Expert Expert
To clarify:

As explained in the manual, the number specified inside the parentheses of integer fields does NOT affect the actual storage capacity of the field, as is the case with string types.

They just set a display width that can be used by applications if they so choose.

The only real effect this has inside MySQL is if the field is also created with the ZEROFILL option, in which case MySQL returns the field padded to the display width using zeros.
May 26 '09 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

8
1998
by: Daz | last post by:
Hi everyone. I was faced with the choice of whether my problem is indeed a PHP problem or a MySQL. I have decided it's a PHP problem as I don't experience the same problem when I execute the...
0
7049
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6912
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7052
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7092
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5348
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4790
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4488
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3000
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
188
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.