Jump to content

mysql datatype question..


vijay

Recommended Posts

Hi..I know if am keeping varchar(10) then have limit up to 10 chars...so like wise for int,float whats mean of int(1) or int(5) etc..What does it mean..? Is there anything like limit as varchar...Thanks & Regards,Vijay

Link to comment
Share on other sites

Hi..I know if am keeping varchar(10) then have limit up to 10 chars...so like wise for int,float whats mean of int(1) or int(5) etc..What does it mean..? Is there anything like limit as varchar...Thanks & Regards,Vijay
int(1) means only 1 number alloud right? like 0 - 9int(2) up to 2 numbers.. like 0 - 99 i think :-)
Link to comment
Share on other sites

Hi.. Its not like you told "int(1) means only 1 number alloud right? like 0 - 9 int(2) up to 2 numbers.. like 0 - 99 " Have u tried this.. try and tell me.. have tried with int(1) and int(2) or write any thing the max no. it can take its 2147483647 (2^31 -1) So it's only consider int. limit not the braces value.. What you say.. ? Is there any thing wrong...?Regards,Vijay

Link to comment
Share on other sites

have tried with int(1) and int(2) or write any thingthe max no. it can take its 2147483647 (2^31 -1) I think what you are saying is that the maximum digit or character the datatypes can handle now we limit the database datatypes to limit also the white spaces that you will enter in the database and that saves allot of spacein your database

Link to comment
Share on other sites

I think I read on MySQLs site that int is an int is an int. They all have the same storage capacity. What differs is that int(1) is meant to only display one character whereas int(7) is meant to display seven characters.Give me a minute, I'll look for that link.EDIT: Hmm, looks like I read that wrong. Here's the link: http://dev.mysql.com/doc/refman/5.0/en/numeric-types.htmlLooks like if you have int(5) and have stored 45, 6999, 78884, and 888557554 in that column, and if you have ZEROFILL specified, then the numbers would be displayed as 00045, 06999, 78884, and 888557554.

Link to comment
Share on other sites

Hi..yea I got it.. but one more thing to clear if am not specifying zerofill then there would be no change in length..(for example, INT(4)). This optional display width is used to display integer values having a width less than the width specified for the column by left-padding them with spaces. when this ( above 2 line )works..? Regards,Vijay

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...