查看表结构
desc table;
show create table 表 \G;
repeat()函数
用来复制字符串,如下'ab'表示要复制的字符串,2表示复制的份数
mysql> select repeat('ab',2);
+----------------+
| repeat('ab',2) |
+----------------+
| abab |
+----------------+
1 row in set (0.00 sec)
又如
mysql> select repeat('a',2);
+---------------+
| repeat('a',2) |
+---------------+
| aa |
+---------------+
1 row in set (0.00 sec)
avg(),sum(),count(),max(),min() 统计函数
date_format(列,输出格式)
mysql> select date_format(build_time,'%Y%m%d') from logmgr_log limit 1;
+----------------------------------+| date_format(build_time,'%Y%m%d') |
+----------------------------------+
| 20170414 |
+----------------------------------+
mysql> select date_format(build_time,'%Y%m%d') from logmgr_log limit 1;
+----------------------------------+
| date_format(build_time,'%Y%m%d') |
+----------------------------------+
| 20170414 |
+----------------------------------+
now()
mysql> select now() ;
+---------------------+
| now() |
+---------------------+
| 2017-05-18 18:45:23 |
+---------------------+
mid() 文本提取字符
mysql> select mid(build_time,1,10) from logmgr_log ;
+----------------------+
| mid(build_time,1,10) |
+----------------------+
| 2017-04-14 |
+----------------------+