MySQL:命令整理:修订间差异

来自WHY42
imported>Soleverlee
无编辑摘要
imported>Soleverlee
 
(未显示同一用户的1个中间版本)
第1行: 第1行:
=常用函数=
=常用函数=
*database():获取当前use的数据库名称
{| class="wikitable" border="1"
*version():获取数据库版本信息
|-
*ifnull(field, 'Something'):测试是否为空,为空则返回默认值
! 函数
 
! 备注
|-
| database()
| 获取当前use的数据库名称
|-
| version()
| 获取数据库版本信息
|-
| ifnull(field, 'Something')
| 测试是否为空,为空则返回默认值
|-
| current_date()
| 获取当前日期
|}
<source lang="sql">
<source lang="sql">
select rol_id, ifnull(remark, 'No Remark') from rol;
select rol_id, ifnull(remark, 'No Remark') from rol;
</source>
</source>
=特殊查询=
=特殊查询=
*limit:限制查询结果条数
*limit:限制查询结果条数
<source lang="sql">
<source lang="sql">
select * from rol limit 5;
select * from rol limit 5;
</source>
*查询到文件中:
<source lang="sql">
select content into dumpfile 'd:/1.hex' from wf_process where name='projectFlow';
</source>
</source>


[[Category:Database]]
[[Category:Database]]

2016年7月21日 (四) 14:01的最新版本

常用函数

函数 备注
database() 获取当前use的数据库名称
version() 获取数据库版本信息
ifnull(field, 'Something') 测试是否为空,为空则返回默认值
current_date() 获取当前日期
select rol_id, ifnull(remark, 'No Remark') from rol;

特殊查询

  • limit:限制查询结果条数
select * from rol limit 5;
  • 查询到文件中:
select content into dumpfile 'd:/1.hex' from wf_process where name='projectFlow';