当前位置:网站首页>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()
边栏推荐
- Very nervous. What should I do on the first day of software testing?
- Unity dotween plug-in description
- Nestjs中控制器和路由的配置使用
- 企事业单位源代码防泄露工作该如何进行
- Intellj idea jars projects containing external lib to other project reference methods - jars
- [recruitment] UE4 Development Engineer
- 图扑软件基于钻孔数据的三维地质模型可视化
- Revit Secondary Development - - Project use Panel features not opened
- 14x1.5cm vertical label is a little difficult, VFP calls bartender to print
- uboot通过终端发送‘r‘字符读取ddr内存大小
猜你喜欢

The fourth day of learning C language for Asian people

14x1.5cm竖向标签有点难,VFP调用BarTender来打印

终端便捷ssh(免密)连接

Unity2019.3.8f1 development environment configuration of hololens2

Unity 3D model operation and UI conflict Scrollview

9. naive Bayes

Rotation, translation and scaling of unity VR objects

Pit of smoothstep node in shadergraph

使用码云PublicHoliday项目判断某天是否为工作日

3D rotation album
随机推荐
Unity mobile end sliding screen rotation
ParticleSystem in the official Manual of unity_ Collision module
Chapter 7 vertex processing and drawing commands of OpenGL super classic (7th Edition)
Bev instance prediction based on monocular camera (iccv 2021)
East Tower attack and defense world - XSS bypasses the safety dog
【LeetCode】Easy | 225. Using queue to realize stack (pure C manual tearing queue)
Wechat applet training 2
Revit二次开发---未打开项目使用面板功能
【VCS+Verdi联合仿真】~ 以计数器为例
Intellj idea generates jar packages for projects containing external lib to other projects. The method refers to the jar package written by itself
Records of some problems encountered during unity development (continuously updated)
Unity determines whether the UI is clicked
Unity obtains serial port data
Revit Secondary Development - - Project use Panel features not opened
Xctf--Web--Challenge--area Wp
unity 扫描圈 圆扩展方法
Intellj idea jars projects containing external lib to other project reference methods - jars
Detailed explanation of the loss module of mmdet
Word frequency statistics (string, list)
Win10 vs2015 compiling curaengine