Which is best? Put simply, use a VARCHAR field instead of TEXT for columns between 255 and 65k characters if possible as it will lead to potentially fewer disk reads and less writes. VARCHAR Max size of 65535 characters Uses 2+n bytes to store the value where n is the length of the stored string. […]
Basically an index on a table works like an index in a book. They are a way to avoid scanning the full table to obtain the result that you’re looking for. Say you have a book and you want to find some information about something particular. Without an index you’d have to go through the […]
To Auto Timestamp A Row Set row type as "timestamp" Default: CURRENT_TIMESTAMP On Update Current_Timestamp: checked if you want the timestamp to update when the row changed, not checked to only timewstamp it on creation. This is an equivalent in code: CREATED timestamp NOT NULL default '0000-00-00 00:00:00', UPDATED timestamp NOT NULL default now() on update now(), […]
Common Use Reserved Names Don't use the followign reserved names as otherwise you'll have to put them single quotes whenever you use them: index Full list here
Quick Data Types List (For a more in depth description see below) Numeric BOOL Use TINYINT BIT The BIT data type is used to store bit-field values. A type of BIT(M) enables storage of M-bit values. M can range from 1 to 64. (Not universally supported) INT A normal-sized integer that can be signed or unsigned. […]
Create as 'Int' and set to 'Auto Increment' Don't call the row Index as its a special MySQL word which you'll have to use in quotes if you do.