首页 > 代码库 > SQL的一切常用函数展示

SQL的一切常用函数展示

练习了一下,

用时再慢慢看吧。

SHOW WARNINGS;
SELECT quote(text_fld) FROM string_tbl;
SELECT CONCAT(danke sch, CHAR(148), n);
SELECT ASCII(ö);
SELECT LENGTH(char_fld) char_length FROM string_tbl;
SELECT POSITION(is IN vchar_fld) FROM string_tbl;
SELECT (37 * 59) / (78 - (8 * 6));
SELECT MOD(10,4);

  

SELECT POW(2,10) kilobyte, POW(2,20) megabyte,    -> POW(2,30) gigabyte, POW(2,40) terabyte;
SELECT ROUND(72.0909, 1), ROUND(72.0909, 2), ROUND(72.0909, 3);
SELECT account_id, SIGN(avail_balance), ABS(avail_balance)    -> FROM account;
SELECT @@global.time_zone, @@session.time_zone;
SELECT CAST(2008-09-17 15:30:00 AS DATETIME);
SELECT CAST(2008-09-17 AS DATE) date_field,    -> CAST(108:17:57 AS TIME) time_field;
SELECT CURRENT_DATE(), CURRENT_TIME(), CURRENT_TIMESTAMP();
SELECT DATE_ADD(CURRENT_DATE(), INTERVAL 5 DAY);
SELECT LAST_DAY(2008-09-17);
SELECT DAYNAME(2008-09-18);
SELECT EXTRACT(YEAR FROM 2008-09-18 22:19:05);
SELECT DATEDIFF(2009-09-03, 2009-06-24);
SELECT CAST(1456328 AS SIGNED INTEGER);
SELECT CAST(999ABC111 AS UNSIGNED INTEGER);

 

SQL的一切常用函数展示