mysql部分函数试用
2016-08-17 15:36
302 查看
mysql> select ASCII("2");
+------------+
| ASCII("2") |
+------------+
| 50 |
+------------+
1 row in set
mysql> select BIN(12);
+---------+
| BIN(12) |
+---------+
| 1100 |
+---------+
1 row in set
mysql> select BIN(1
12);
+----------+
| BIN(112) |
+----------+
| 1110000 |
+----------+
1 row in set
mysql> select ASCII("a
");
+------------+
| ASCII("a") |
+------------+
| 97 |
+------------+
1 row in set
mysql> select CONV("a",10,2);
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select CONV("a",10,2)' at line 3
mysql> select CONV("a",16
,2);
+----------------+
| CONV("a",16,2) |
+----------------+
| 1010 |
+----------------+
1 row in set
mysql> select conv(16,10,16);
+----------------+
| conv(16,10,16) |
+----------------+
| 10 |
+----------------+
1 row in set
mysql> select conv(16,10,15
);
+----------------+
| conv(16,10,15) |
+----------------+
| 11 |
+----------------+
1 row in set
mysql> select char(97);
+----------+
| char(97) |
+----------+
| a |
+----------+
1 row in set
mysql> select concat('my','sql');
+--------------------+
| concat('my','sql') |
+--------------------+
| mysql |
+--------------------+
1 row in set
mysql> select left('school',3);
+------------------+
| left('school',3) |
+------------------+
| sch |
+------------------+
1 row in set
mysql> select substring('school',3,4
);
+-------------------------+
| substring('school',3,4) |
+-------------------------+
| hool |
+-------------------------+
1 row in set
mysql> select substring('school',3,10
);
+--------------------------+
| substring('school',3,10) |
+--------------------------+
| hool |
+--------------------------+
1 row in set
mysql> select substring('school',3,2
);
+-------------------------+
| substring('school',3,2) |
+-------------------------+
| ho |
+-------------------------+
1 row in set
mysql> select trim('scsssv ho ol'
);
+------------------------+
| trim('scsssv ho ol') |
+------------------------+
| scsssv ho ol |
+------------------------+
1 row in set
mysql> select l
trim(' scsssv ho ol');
+----------------------------+
| ltrim(' scsssv ho ol') |
+----------------------------+
| scsssv ho ol |
+----------------------------+
1 row in set
mysql> select r
trim(' scsssv ho ol ');
+-------------------------------------+
| rtrim(' scsssv ho ol ') |
+-------------------------------------+
| scsssv ho ol |
+-------------------------------------+
1 row in set
mysql> select
trim(' scsssv ho ol ');
+------------------------------------+
| trim(' scsssv ho ol ') |
+------------------------------------+
| scsssv ho ol |
+------------------------------------+
1 row in set
mysql> select soundex("schul");
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select soundex("schul")' at line 3
mysql> select soundex("schoo
l");
+-------------------+
| soundex("school") |
+-------------------+
| S400 |
+-------------------+
1 row in set
mysql> select soundex("hello
");
+------------------+
| soundex("hello") |
+------------------+
| H400 |
+------------------+
1 row in set
mysql> select space(' ');
+--------------+
| space(' ') |
+--------------+
| |
+--------------+
1 row in set
mysql> select reverse('sadfaf asfdawwww');
+-----------------------------+
| reverse('sadfaf asfdawwww') |
+-----------------------------+
| wwwwadfsa fafdas |
+-----------------------------+
1 row in set
mysql> select replace('ouousfsf','sf','ssff');
+---------------------------------+
| replace('ouousfsf','sf','ssff') |
+---------------------------------+
| ououssffssff |
+---------------------------------+
1 row in set
mysql> select export_set(23,'23','Y','YWE','ss');
+------------------------------------+
| export_set(23,'23','Y','YWE','ss') |
+------------------------------------+
| |
+------------------------------------+
1 row in set
mysql> select export_set(23,'23','Y','YWE','ss');
+------------------------------------+
| export_set(23,'23','Y','YWE','ss') |
+------------------------------------+
| |
+------------------------------------+
1 row in set
mysql> select ucase
(23,'23','Y','YWE','ss');
1582 - Incorrect parameter count in the call to native function 'ucase'
1582 - Incorrect parameter count in the call to native function 'ucase'
->
-> select ucase('Hey');
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1582 - Incorrect parameter count in the call to native function 'ucase'
sele' at line 1
mysql> ;
1065 - Query was empty
mysql> select UCASE
('Hey');
+--------------+
| UCASE('Hey') |
+--------------+
| HEY |
+--------------+
1 row in set
mysql> select (select UCASE('ucase
'))('Hey');
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '('Hey')' at line 1
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '('Hey')' at line 1
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1064 - You have an error in your SQL syntax' at line 1
->
-> select hour('8:00:00');
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'the manual that corresponds to your MySQL server version for the right syntax to' at line 1
mysql> select HOUR
('8:00:00');
+-----------------+
| HOUR('8:00:00') |
+-----------------+
| 8 |
+-----------------+
1 row in set
mysql> select HOUR('
11:00:00');
+------------------+
| HOUR('11:00:00') |
+------------------+
| 11 |
+------------------+
1 row in set
mysql> select curdate();
+------------+
| curdate() |
+------------+
| 2016-08-17 |
+------------+
1 row in set
mysql> select curtime
();
+-----------+
| curtime() |
+-----------+
| 15:15:02 |
+-----------+
1 row in set
mysql> select concat(select curtime(),select curdate());
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select curtime(),select curdate())' at line 1
mysql>
mysql>
mysql> select maketime(2016,220);
1582 - Incorrect parameter count in the call to native function 'maketime'
mysql> select MAKETIME
(2016,220);
1582 - Incorrect parameter count in the call to native function 'MAKETIME'
1582 - Incorrect parameter count in the call to native function 'MAKETIME'
-> select time(8:22:22);
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1582 - Incorrect parameter count in the call to native function 'MAKETIME'
s' at line 1
mysql>
mysql>
mysql>
mysql> select Now();
+---------------------+
| Now() |
+---------------------+
| 2016-08-17 15:18:07 |
+---------------------+
1 row in set
mysql> select TIMESTAMP();
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
mysql> select TIMESTAMP(23
);
+---------------+
| TIMESTAMP(23) |
+---------------+
| NULL |
+---------------+
1 row in set
mysql> select SLEEP
(3);
+----------+
| SLEEP(3) |
+----------+
| 0 |
+----------+
1 row in set
mysql> select UUID
();
+--------------------------------------+
| UUID() |
+--------------------------------------+
| 10d3ad27-644b-11e6-bee7-507b9d17ef78 |
+--------------------------------------+
1 row in set
mysql> select UUID();
+--------------------------------------+
| UUID() |
+--------------------------------------+
| 134b4482-644b-11e6-bee7-507b9d17ef78 |
+--------------------------------------+
1 row in set
+------------+
| ASCII("2") |
+------------+
| 50 |
+------------+
1 row in set
mysql> select BIN(12);
+---------+
| BIN(12) |
+---------+
| 1100 |
+---------+
1 row in set
mysql> select BIN(1
12);
+----------+
| BIN(112) |
+----------+
| 1110000 |
+----------+
1 row in set
mysql> select ASCII("a
");
+------------+
| ASCII("a") |
+------------+
| 97 |
+------------+
1 row in set
mysql> select CONV("a",10,2);
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select CONV("a",10,2)' at line 3
mysql> select CONV("a",16
,2);
+----------------+
| CONV("a",16,2) |
+----------------+
| 1010 |
+----------------+
1 row in set
mysql> select conv(16,10,16);
+----------------+
| conv(16,10,16) |
+----------------+
| 10 |
+----------------+
1 row in set
mysql> select conv(16,10,15
);
+----------------+
| conv(16,10,15) |
+----------------+
| 11 |
+----------------+
1 row in set
mysql> select char(97);
+----------+
| char(97) |
+----------+
| a |
+----------+
1 row in set
mysql> select concat('my','sql');
+--------------------+
| concat('my','sql') |
+--------------------+
| mysql |
+--------------------+
1 row in set
mysql> select left('school',3);
+------------------+
| left('school',3) |
+------------------+
| sch |
+------------------+
1 row in set
mysql> select substring('school',3,4
);
+-------------------------+
| substring('school',3,4) |
+-------------------------+
| hool |
+-------------------------+
1 row in set
mysql> select substring('school',3,10
);
+--------------------------+
| substring('school',3,10) |
+--------------------------+
| hool |
+--------------------------+
1 row in set
mysql> select substring('school',3,2
);
+-------------------------+
| substring('school',3,2) |
+-------------------------+
| ho |
+-------------------------+
1 row in set
mysql> select trim('scsssv ho ol'
);
+------------------------+
| trim('scsssv ho ol') |
+------------------------+
| scsssv ho ol |
+------------------------+
1 row in set
mysql> select l
trim(' scsssv ho ol');
+----------------------------+
| ltrim(' scsssv ho ol') |
+----------------------------+
| scsssv ho ol |
+----------------------------+
1 row in set
mysql> select r
trim(' scsssv ho ol ');
+-------------------------------------+
| rtrim(' scsssv ho ol ') |
+-------------------------------------+
| scsssv ho ol |
+-------------------------------------+
1 row in set
mysql> select
trim(' scsssv ho ol ');
+------------------------------------+
| trim(' scsssv ho ol ') |
+------------------------------------+
| scsssv ho ol |
+------------------------------------+
1 row in set
mysql> select soundex("schul");
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select soundex("schul")' at line 3
mysql> select soundex("schoo
l");
+-------------------+
| soundex("school") |
+-------------------+
| S400 |
+-------------------+
1 row in set
mysql> select soundex("hello
");
+------------------+
| soundex("hello") |
+------------------+
| H400 |
+------------------+
1 row in set
mysql> select space(' ');
+--------------+
| space(' ') |
+--------------+
| |
+--------------+
1 row in set
mysql> select reverse('sadfaf asfdawwww');
+-----------------------------+
| reverse('sadfaf asfdawwww') |
+-----------------------------+
| wwwwadfsa fafdas |
+-----------------------------+
1 row in set
mysql> select replace('ouousfsf','sf','ssff');
+---------------------------------+
| replace('ouousfsf','sf','ssff') |
+---------------------------------+
| ououssffssff |
+---------------------------------+
1 row in set
mysql> select export_set(23,'23','Y','YWE','ss');
+------------------------------------+
| export_set(23,'23','Y','YWE','ss') |
+------------------------------------+
| |
+------------------------------------+
1 row in set
mysql> select export_set(23,'23','Y','YWE','ss');
+------------------------------------+
| export_set(23,'23','Y','YWE','ss') |
+------------------------------------+
| |
+------------------------------------+
1 row in set
mysql> select ucase
(23,'23','Y','YWE','ss');
1582 - Incorrect parameter count in the call to native function 'ucase'
1582 - Incorrect parameter count in the call to native function 'ucase'
->
-> select ucase('Hey');
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1582 - Incorrect parameter count in the call to native function 'ucase'
sele' at line 1
mysql> ;
1065 - Query was empty
mysql> select UCASE
('Hey');
+--------------+
| UCASE('Hey') |
+--------------+
| HEY |
+--------------+
1 row in set
mysql> select (select UCASE('ucase
'))('Hey');
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '('Hey')' at line 1
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '('Hey')' at line 1
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1064 - You have an error in your SQL syntax' at line 1
->
-> select hour('8:00:00');
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'the manual that corresponds to your MySQL server version for the right syntax to' at line 1
mysql> select HOUR
('8:00:00');
+-----------------+
| HOUR('8:00:00') |
+-----------------+
| 8 |
+-----------------+
1 row in set
mysql> select HOUR('
11:00:00');
+------------------+
| HOUR('11:00:00') |
+------------------+
| 11 |
+------------------+
1 row in set
mysql> select curdate();
+------------+
| curdate() |
+------------+
| 2016-08-17 |
+------------+
1 row in set
mysql> select curtime
();
+-----------+
| curtime() |
+-----------+
| 15:15:02 |
+-----------+
1 row in set
mysql> select concat(select curtime(),select curdate());
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select curtime(),select curdate())' at line 1
mysql>
mysql>
mysql> select maketime(2016,220);
1582 - Incorrect parameter count in the call to native function 'maketime'
mysql> select MAKETIME
(2016,220);
1582 - Incorrect parameter count in the call to native function 'MAKETIME'
1582 - Incorrect parameter count in the call to native function 'MAKETIME'
-> select time(8:22:22);
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1582 - Incorrect parameter count in the call to native function 'MAKETIME'
s' at line 1
mysql>
mysql>
mysql>
mysql> select Now();
+---------------------+
| Now() |
+---------------------+
| 2016-08-17 15:18:07 |
+---------------------+
1 row in set
mysql> select TIMESTAMP();
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
mysql> select TIMESTAMP(23
);
+---------------+
| TIMESTAMP(23) |
+---------------+
| NULL |
+---------------+
1 row in set
mysql> select SLEEP
(3);
+----------+
| SLEEP(3) |
+----------+
| 0 |
+----------+
1 row in set
mysql> select UUID
();
+--------------------------------------+
| UUID() |
+--------------------------------------+
| 10d3ad27-644b-11e6-bee7-507b9d17ef78 |
+--------------------------------------+
1 row in set
mysql> select UUID();
+--------------------------------------+
| UUID() |
+--------------------------------------+
| 134b4482-644b-11e6-bee7-507b9d17ef78 |
+--------------------------------------+
1 row in set
相关文章推荐
- MySQL 部分函数使用
- mysql部分常用函数DATE_FORMAT(a.Created_time,'%Y-%m-%d%H
- MySQL Innodb的事务部分 函数调用关系
- mysql 部分函数内容小记
- MYSQL 部分函数的运用(Iif, isnull , ifnull, nullif)
- MySQL 函数:获取字符串字母部分
- MYSQL的存储过程、变量、函数及部分简单优化(非常有用,有存储过程+光标实例)
- Mysql C API部分函数讲解
- 数据库学习纪要(二十八):MySQL-8-部分数据函数
- Window CryptApi 部分函数声明[中文]
- QB部分语句&函数的解释(中文)
- Mysql5.0试用,呵呵
- 《C++捷径教程》读书笔记--Chapter 8--函数,第二部分:引用,重载和默认参数
- C#部分函数列表
- 试用EMS MySQL manager
- Mysql日期和时间函数
- SQL取日期部分函数
- Mysql日期和时间函数
- 《C++捷径教程》读书笔记--Chapter 7--函数,第一部分:基础知识(第二部分)
- PHP 的 MySQL 操作类,跟手册上的函数一样用,但是更方便了。多说无益,看了就知道了。