0

Hi there i was learn mysql from videos at youtube,and i want to create table .I have one variable that is a number ,that i want it to be number of the messeges from users.. It is now int varaible but i found that the max of int is 255.. i want to be bigger what the right varible? And is the variable messege text () not null..is right ?

The code is :

$sql = "CREATE TABLE mssegeFromUsers 
(
NemberMsg INT (255) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
 Name VARCHAR(15) NOT NULL,
 Mail VARCHAR(30) NOT NULL,
 Messege TEXT() NOT NULL
 )";

I want the massege from user te be long.. It's right?

sumit
  • 15,003
  • 12
  • 69
  • 110
hasan
  • 25
  • 1
  • 7
  • Max of `INT UNSIGNED` is `4294967295` - [Integer Types](https://dev.mysql.com/doc/refman/5.7/en/integer-types.html) – Paul Spiegel Feb 03 '17 at 00:59

1 Answers1

0

You can see the answer on this question- What is the size of column of int(11) in mysql in bytes?

int will hold 4 bytes of data (so numbers between -2147483648 and 2147483648)

If the number is outside this range, choose either BIGINT (with max of 9223372036854775807) or stick with VARCHAR and set set the character length.

Community
  • 1
  • 1
jwood74
  • 124
  • 1
  • 7
  • Thank you, is that mean its will save the masseges at numbers 1,2,3,4 .....2147483648..i – hasan Feb 03 '17 at 01:06
  • Yes, any number between -2147483648 and 2147483648 will fit in an INT column. Eg. 100 or 1000000 or 1000000000 – jwood74 Feb 03 '17 at 01:10