otuatail Posted November 14, 2007 Share Posted November 14, 2007 Can anyone tell me what the equivelent is for tiny int, as it is not recognised in my table creation script. Auto number is set to int(11) which seems an odd number. It can't be 11 bytes? Need help with the basic types tiny int small int medium int and integer Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted November 14, 2007 Share Posted November 14, 2007 check the following link http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html and int(11) means a number till 11 digits Quote Link to comment Share on other sites More sharing options...
otuatail Posted November 14, 2007 Author Share Posted November 14, 2007 Still having problems with the int data types The Mysql server states the value in brackets is optional but can be larger tha n required. int() can be int(4) ant tinyint can be tinyint(1), but when I add the field through phpmyadmin it gives me tinyint(4). Also leaving the number out creates an error. Desmond. Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted November 14, 2007 Share Posted November 14, 2007 can you paste your table creation script here Quote Link to comment Share on other sites More sharing options...
otuatail Posted November 14, 2007 Author Share Posted November 14, 2007 My table and page work fine. I am just confused over the values in brackets DROP TABLE IF EXISTS `thread2`; CREATE TABLE IF NOT EXISTS `thread2` ( `id` int(11) NOT NULL auto_increment, `owner_id` smallint(2) UNSIGNED, `CreateDate` int(4) UNSIGNED, `UpdateDate` int(4) UNSIGNED, `Cat` tinyint(1) UNSIGNED, `Visible` tinyint(1) UNSIGNED, `Writable` tinyint(1) UNSIGNED, `Pinable` tinyint(1) UNSIGNED, `View` smallint(2) UNSIGNED, `Reply` smallint(2) UNSIGNED, `subject` char(200), PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=1 ; If Ileave them out I get a table creation error. Also if I add a field tinyint using PHPmyadmin it apears as tinyint(4) not tinyint(1) Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted November 14, 2007 Share Posted November 14, 2007 whats is the confusion about ? that states the length of the datatype Quote Link to comment Share on other sites More sharing options...
otuatail Posted November 14, 2007 Author Share Posted November 14, 2007 Confusion! what is the size of a tinyint mysql.com manual states one byte. and can be tinyint() or tinyint(1). I have used the latter. PHPmyadmin [Add field to end of table] reveals a structure tinyint(4) //tiny int 4 bytes? And to add more confusion to this. The manual states that not only can you have smalint(2) but you can have smallint(3). The explanation is not clear but asumes you can exceed the maximum. Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted November 14, 2007 Share Posted November 14, 2007 its in bits I think not bytes Quote Link to comment Share on other sites More sharing options...
otuatail Posted November 14, 2007 Author Share Posted November 14, 2007 if it is in bits then tinyint(4) = 16 a byte = 8 bits Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.