Mega Code Archive

 
Categories / MySQL Tutorial / Data Types
 

The basic datatypes

Datatype Description Example: INTNumeric entryid INT VARCHAR(n)Text string of characters up to n with a maximim of 255 charactersmyVarChar VARCHAR(20) CHAR(n)Text string with specific number (n) of characters.myChar CHAR(30) TEXTHolds between 255 - 65535 charactersmyText TEXT DATEThe date stored in the format YYYY-MM-DDmyDate DATE TIMEThe time stored in the format HH:MM:SSmyTime TIME The syntax for defining a field and datatype is 'fieldname datatype'. If string length in CHAR(n) Column is less than 'n' then the string is padded by spaces (spaces are removed when data is retrieved). n for CHAR(n) is 255 Maximum.