|
This tutorial will cover the various methods of storing data in a MySQL database table, there are a lot of data types, but frankly, you don't need to know them all, the following are the most useful.
INT Stands for Integer. Handles a number between -2147483648 and 2147483648 when signed. Handles a number between 0 and 4294967295 when unsigned.
TINYINT Same as INT, except very small. Signed, -128 to 127. Unsigned, 0 to 255.
BIGINT Same as INT, except very big. Signed, -9223372036854775808 to 9223372036854775808. Unsigned, 0 to 18446744073709551615
DATE Stores a date in the format YYYY-MM-DD
TIME Stores a time in the format HH:MM:SS
DATETIME Very much the most useful of the time data types. Stores the exact date and time, which can be extracted seperately. Stores in the format YYYY-MM-DD HH:MM:SS.
VARCHAR(NUM) Stores a string between 0 and 255 characters in length, you have define NUM (number of max characters) when you create aVARCHAR field, cannot be higher than 255.
TEXT Stores a string between 0 and 65535 characters.
LONGTEXT Stores a string between 0 and 4294967295 characters.
Well, there you go, thats basically all you need to store your common data types.
|
|
|