当前位置:网站首页>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()
边栏推荐
- Unity3d get screen width and height
- Unity gets the resolution of the game view
- 炒美原油的国际交易平台如何能保障资金安全呢?
- 3D rotation album
- Unity publishing /build settings
- Connect() and disconnect() of socket in C #
- Unity obtains serial port data
- Unity 3D model operation and UI conflict Scrollview
- East Tower attack and defense world - XSS bypasses the safety dog
- Chapter 8 primitive processing of OpenGL super classic (version 7)
猜你喜欢

东塔攻防世界—xss绕过安全狗

Unity scroll view element drag and drop to automatically adsorb centering and card effect

【 VCS + Verdi joint simulation】 ~ Taking Counter as an Example

VFPBS在IIS下调用EXCEL遇到的Access is denied

Unity + hololens publishing settings

Chinese pycharm changed to English pycharm

Win10 vs2015 compiling curaengine

Unity C trigonometric function, right triangle corner calculation

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

Installation and getting started with pytoch
随机推荐
Network communication problem locating steps
Introduction to mmcv common APIs
GoLand No Tests Were Run : 不能使用 fmt.Printf() <BUG>
Win10 vs2015 compiling curaengine
2021-10-31
【VCS+Verdi联合仿真】~ 以计数器为例
Revit二次開發---未打開項目使用面板功能
[typescript] defines the return value type of promise
Tensorflow2 of ubantu18.04 X installation
Untiy3d controls scene screenshots through external JSON files
Unity publishing /build settings
The file has been downloaded incorrectly!
Another download address for typro
产生 BUG 测试人员需要自己去分析原因吗?
MinGW-w64下载文件失败the file has been downloaded incorrectly!
Unity gets the resolution of the game view
E: Topic focus
Postman 做测试的 6 个常见问题
Unity packaging and publishing webgl error reason exception: failed building webgl player
14x1.5cm竖向标签有点难,VFP调用BarTender来打印