SQL-learning-fundation
SQL基础教程
use <database>
一、MySQL的数据类型
主要包括以下五大类:
- 1整数类型:
取值范围如果加了unsigned,则最大值翻倍,如tinyint unsigned的取值范围为(0~256)。
| MySQL数据类型 | 含义 | 字节 |
|---|---|---|
| tinyint(m) | 范围(-128~127) | 1 |
| smallint(m) | 范围(-32768~32767) | 2 |
| mediumint(m) | 范围(-8388608~8388607) | 3 |
| int(m) | 范围(-2147483648~2147483647) | 4 |
| bigint(m) | 范围(+-9.22*10的18次方) | 8 |
- 2浮点型(float和double)
| MySQL数据类型 | 含义 | 字节 |
|---|---|---|
| float(m,d) | 单精度浮点型 | 8位精度(4字节),m总个数,d小数位 |
| double(m,d) | 双精度浮点型 | 16位精度(8字节),m总个数,d小数位 |
- 3定点数
| MySQL数据类型 | 含义 | 字节 |
|---|---|---|
| decimal(m,d) | 浮点型在数据库中存放的是近似值,而定点类型在数据库中存放的是精确值 | 参数m<65 是总个数,d<30且 d |
浮点数类型:FLOAT、DOUBLE、DECIMAL
字符串类型:CHAR、VARCHAR、TINY TEXT、TEXT、MEDIUM TEXT、LONGTEXT、TINY BLOB、BLOB、MEDIUM BLOB、LONG BLOB
日期类型:Date、DateTime、TimeStamp、Time、Year
其他数据类型:BINARY、VARBINARY、ENUM、SET、Geometry、Point、MultiPoint、LineString、MultiLineString、Polygon、GeometryCollection等
CREATE USER 'test'@'%' IDENTIFIED BY '558-';
前提是有test_winform这个database grant all privileges on test_winform.* to test@localhost identified by '558-';
grant all privileges on test_winform.* to test@'%' identified by '558-';
DROP USER 'test'@'%';
flush privileges;
