Will install MySQL, will be a few SQL statements, will JDBC, hibernate configuration, thought will be MySQL, in recent days the interview was asked to MySQL problem, shame, systematic study.
One of the MySQL optimizations, select the appropriate rather than the largest data type.
Integral type
Type |
Bytes occupied |
Range |
TINYINT |
1 |
2^8 |
SMALLINT |
2 |
2^16 |
Mediumint |
3 |
2^24 |
Int |
4 |
2^32 |
BIGINT |
8 |
2^64 |
Floating point Type
Type |
Describe |
float[(M,D)] |
M represents the maximum total number of digits, and D indicates the maximum number of digits after the decimal point |
double[(M,D)] |
Ditto |
Date type
Type |
Range |
Year |
1970~2069 |
Time |
-8385959~8385959 |
DATE |
1000-01-01~9999-12-31 |
Datetime |
1000-01-01 00:00:00~9999-12-31 23:59:59 |
Datestamp |
1970-01-01 00:00:00~2037-12-31 23:59:59 |
Character type (omit enum type and collection)
Type |
Range |
CHAR (M) |
Fixed length, m characters 0~255 |
VARCHAR (M) |
Variable length, l+1 characters, l<=m,l<=m<=65535 |
Tinytext |
Holds up to 2^8 characters |
TEXT |
Holds up to l<2^16 characters |
Mediumtext |
Holds up to l<2^24 characters |
Longtext |
Holds up to l<2^32 characters |
MySQL field type