当前位置:网站首页>Database SQL language 06 single line function
Database SQL language 06 single line function
2022-06-30 05:22:00 【Chao Ge 1986】
String functions and mathematical functions
SELECT ABS(-8); /* The absolute value */
SELECT CEILING(9.4); /* Rounding up */
SELECT FLOOR(9.4); /* Rounding down */
SELECT RAND(); /* random number , Return to one 0-1 Random number between */
SELECT SIGN(0); /* Symbolic function : A negative number returns -1, A positive number returns 1,0 return 0*/
SELECT CHAR_LENGTH(' Crazy God says persistence can succeed '); /* Returns the number of characters contained in a string */
SELECT CONCAT(' I ',' Love ',' Program '); /* Merge strings , Parameters can have multiple */
SELECT INSERT(' I love programming. helloworld',1,2,' Super love '); /* Replace string , Start from a certain position to replace Change a certain length */
SELECT LOWER('KuangShen'); /* A lowercase letter */
SELECT UPPER('KuangShen'); /* Capitalization */
SELECT LEFT('hello,world',5); /* Cut from the left */
SELECT RIGHT('hello,world',5); /* Cut from the right */
SELECT REPLACE(' Crazy God says persistence can succeed ',' insist ',' Strive '); /* Replace string */
SELECT SUBSTR(' Crazy God says persistence can succeed ',4,6); /* Intercepting string , Start and length */
SELECT REVERSE(' Crazy God says persistence can succeed '); /* reverse
-- Look up the students surnamed Zhou , Change to Zou
SELECT REPLACE(studentname,' Zhou ',' Zou ') AS New name
FROM student WHERE studentname LIKE ' Zhou %';
Date and time functions
SELECT CURRENT_DATE(); /* Get current date */
SELECT CURDATE(); /* Get current date */
SELECT NOW(); /* Get the current date and time */
SELECT LOCALTIME(); /* Get the current date and time */
SELECT SYSDATE(); /* Get the current date and time */
-- Get date , Minutes and seconds
SELECT YEAR(NOW());
SELECT MONTH(NOW());
SELECT DAY(NOW());
SELECT HOUR(NOW());
SELECT MINUTE(NOW());
SELECT SECOND(NOW());
– Numerical function
abs(x) -- The absolute value abs(-10.9) = 10
format(x, d) -- Format the number of thousandths format(1234567.456, 2) = 1,234,567.46
ceil(x) -- Rounding up ceil(10.1) = 11
floor(x) -- Rounding down floor (10.1) = 10
round(x) -- Round to the nearest whole
mod(m, n) -- m%n m mod n Seeking remainder 10%3=1
pi() -- Get the pi
pow(m, n) -- m^n
sqrt(x) -- Arithmetical square root
rand() -- random number
truncate(x, d) -- Intercept d Decimal place
– Time date function
now(), current_timestamp(); -- Current date time
current_date(); -- The current date
current_time(); -- current time
date('yyyy-mm-dd hh:ii:ss'); -- Get the date part
time('yyyy-mm-dd hh:ii:ss'); -- Get the time part
date_format('yyyy-mm-dd hh:ii:ss', '%d %y %a %d %m %b %j'); -- Format time
unix_timestamp(); -- get unix Time stamp
from_unixtime(); -- Get the time from the time stamp
– String function
length(string) -- string length , byte
char_length(string) -- string Characters of
substring(str, position [,length]) -- from str Of position Start , take length Characters
replace(str ,search_str ,replace_str) -- stay str of use replace_str Replace search_str
instr(string ,substring) -- return substring First time in string Where in
concat(string [,...]) -- Connection string
charset(str) -- Returns the string character set
lcase(string) -- Convert to lowercase
left(string, length) -- from string2 From the left side of length Characters
load_file(file_name) -- Read from file
locate(substring, string [,start_position]) -- Same as instr, But you can specify the starting position
lpad(string, length, pad) -- Repeat pad Add to string start , Until the string length is length
ltrim(string) -- Remove the front space
repeat(string, count) -- repeat count Time
rpad(string, length, pad) -- stay str After use pad Add , Until the length is length
rtrim(string) -- Remove back-end space
strcmp(string1 ,string2) -- Compare the size of two strings character by character
-- Aggregate functions
count()
sum();
max();
min();
avg();
group_concat()
边栏推荐
- Tensorflow2 of ubantu18.04 X installation
- Set a plane to camera viewport
- Baiwen.com 7 days Internet of things smart home learning experience punch in the third day
- Use the code cloud publicholiday project to determine whether a day is a working day
- PWN入门(2)栈溢出基础
- Wechat applet training 2
- Chapter 7 vertex processing and drawing commands of OpenGL super classic (7th Edition)
- 2021-10-31
- Unity Catmull ROM curve
- 【VCS+Verdi联合仿真】~ 以计数器为例
猜你喜欢

East Tower attack and defense world - XSS bypasses the safety dog
![[notes] unity Scrollview button page turning](/img/c7/47c4056871d0212ac61524539f0d0e.jpg)
[notes] unity Scrollview button page turning

Unity 3D model operation and UI conflict Scrollview

【LeetCode】Easy | 232. Using stack to realize queue (pure C manual tearing stack)

Intellj idea jars projects containing external lib to other project reference methods - jars

Introduction to mmcv common APIs

Unity project hosting platform plasticscm (learn to use 2)

PWN入门(2)栈溢出基础

Assembly learning tutorial: accessing memory (3)

遥感图像/UDA:Curriculum-Style Local-to-Global Adaptation for Cross-Domain Remote Sensing Image Segmentat
随机推荐
PKCs 12:personal information exchange syntax v1.1 translation part I
Expansion method of unity scanning circle
[learning notes] AssetBundle, xlua, hot update (use steps)
[notes] unity Scrollview button page turning
14x1.5cm竖向标签有点难,VFP调用BarTender来打印
Configuration and use of controllers and routes in nestjs
Bev instance prediction based on monocular camera (iccv 2021)
Writing unityshader with sublimetext
Ugui uses its own function to realize reverse mask
终端便捷ssh(免密)连接
PWN入门(2)栈溢出基础
Chapter 8 primitive processing of OpenGL super classic (version 7)
Unity C trigonometric function, right triangle corner calculation
VFPBS上传EXCEL并保存MSSQL到数据库中
Word frequency statistics (string, list)
Intellj idea jars projects containing external lib to other project reference methods - jars
Pytorchcnn image recognition and classification model training framework
Summary of common loss functions in pytorch
东塔攻防世界—xss绕过安全狗
Some problems encountered in unity steamvr