You are here:Home » MYSQL » MYSQL Data Types

MYSQL Data Types

Data types are assigned to a MYSQL table when the table is first created.
Let's take a quick look at some of the basic data type options available:

Data TypeType of Data Stored In Data Type
TINYINTNumeric Type (-128 thru 127)
SMALLINTNumeric Type (-32768 thru 32767)
MEDIUMINTNumeric Type (-8388608 thru 8388607)
INTNumeric Type (-2147483648 thru 2147483647)
BIGINTNumeric Type (9223372036854775808 thru 9223372036854775807)
CHAR()Characters Without Trailing Spaces (0 thru 255)
VARCHAR()Characters With Trailing Spaces (0 thru 65535)
TINYTEXTText With Maximum Length of 255 Characters
TEXTText With Maximum Length of 65,535 Characters
MEDIUMTEXTText With Maximum Length of 16,777,215 Characters
LONGTEXTText With Maximum Length of 4,294,967,295 Characters
DATETIMEDate/Time Type (0000-00-00 00:00:00)
DATEDate/Time Type (0000-00-00)
TIMESTAMPDate/Time Type (0000-00-00 00:00:00)
TIMEDate/Time Type (00:00:00)
YEARDate/Time Type (0000)
It's all a matter of picking the best option for the type of data that you plan to store, and sticking to the plan!

MYSQL Operators

MYSQL operators are most often used when searching for patterns. Let's review some of the most common operators:
OperatorDescription
AND, &&Logical AND
=Assign a Value (As Part of a SET Statement, or As Part of the SET Clause In An UPDATE Statement)
/Division Operator
=Equal Operator
>=Greater Than or Equal Operator
>Greater Than Operator
<= Less Than or Equal Operator
< Less Than Operator
LIKE Simple Pattern Matching
- Minus Operator
% Modulo Operator
!=, <> Not Equal Operator
NOT LIKE Negation of Simple Pattern Matching
||, OR Logical OR
+ Addition Operator
* Multiplication Operator
As we progress, you will see some of these operators used, and can begin to experiment with others.

0 comments:

Post a Comment