I. Data Types
1. Integer
Data Type |
Storage space |
Description |
Value Range |
TINYINT |
1 byte |
Very small integer |
Signed value:-128 ~ 127 Unsigned value: 0 ~ 255 |
SMALLINT |
2 bytes |
Small integer |
Signed value:-32768 ~ 32767 Unsigned value: 0 ~ 65535 |
MEDIUMNT |
3 bytes |
An integer of medium size |
Signed value:-8388608 ~ 8388607 Unsigned value: 0 ~ 16777215 |
INT |
4 bytes |
Standard integer |
Signed value:-2147483648 ~ 2147483647 Unsigned value: 0 ~ 4294967295 |
BIGINT |
8 bytes |
Big integer |
|
2. Floating Point
Data Type |
Storage space |
Description |
Value Range |
FLOAT |
4 bytes |
But the precision Floating Point Number |
|
DOUBLE |
8 bytes |
Double-precision floating point number |
|
DECIMAL (M, D) |
Custom |
In string format |
|
3. string type
Type |
Storage space |
Description |
Maximum length |
Char [(M)] |
MB bytes |
Fixed Length string |
MB bytes |
Varchar [(M)] |
L + 1 byte |
Variable Length string |
MB bytes |
Tinyblog, tingtext |
L + 1 byte |
Very small blob and text string |
2 ^ 8 characters |
Blog, text |
L + 2 bytes |
Small BLOB and text string |
2 ^ 16-1 bytes |
Mediumblob, mediumtext |
L + 3 bytes |
Moderate BLOB and text string |
2 ^ 24 bytes |
Longblob, longtext |
L + 4 bytes |
Large BLOB and text string |
2 ^ 32-1 bytes |
Enum ('value', 'value ') |
1 or 2 bytes |
Enumeration: You can assign an enumeration member. |
65535 members |
Set ('value', 'value ') |
1, 2, 3, 4, or 8 bytes |
Set: You can assign multiple set members. |
64 members |
4. Date and Time Data
Type |
Storage space |
Description |
Maximum length |
Date |
3 bytes |
YYYY-MM-DD format Representation |
1000-01-01 ~ 9999-12-31 |
TIME |
3 bytes |
Hh: mm: ss format indicates the time value |
-838: 59: 59 ~ 838: 59: 59 |
DATETIME |
8 bytes |
YYYY-MM-DD hh: mm: ss format |
|
TIMESTAMP |
4 bytes |
The format of YYYYMMDDhhmmss indicates the timestamp. |
|
YEAR |
1 byte |
Year Value in YYYY format |
1901 ~ 2155 |
Ii. MySQL database operations
1. log on to the database
Mysql Parameters
-D, -- database = name: Open the specified database
-- Delimiter = name specifies the delimiter
-E, -- vertical display result
-H, -- host = name Server name
-H, -- html provides HTML output
-X, -- xml provides XML output
-P, -- password [= name] password
-P, -- port = # port number
-- Prompt = name: Set the prompt
-U, -- user = name Username
-V, -- version: Output version information and exit
Mysql-h server host address-u user name-p User Password
2. log out
Exit
Quit
\ Q
3. Change the password
4. Create, select, and view Databases
Create a database
Select Database
Delete database content