当前位置:网站首页>MySQL built-in functions
MySQL built-in functions
2022-06-30 12:20:00 【Xiao Ni-_-】
List of articles
Date function

- Get date

- Obtain hours, minutes and seconds :

- Get timestamp

- Add a date to the date

- Subtract the time from the date

- Calculate the number of days between two dates

Use example 1
Create a table to record birthdays

Add a date to the table

Use example 2
Create a message table 
Show all message messages , The release date only shows the date , Don't show the time ; Query information sent within a specified time

String function

- charset

- concat

- instr

- ucase and lcase

- left

- length

- replace

- strcmp

- substring

- ltrim rtrim trim

Use example 1
Ask to show student Information in the table , Display format :“XXX My language is XXX branch , mathematics XXX branch , English XXX branch ”

Use example 2
Find the number of bytes occupied by students' names in the student table

Be careful : length Function returns the length of the string , In bytes . If it is a multi byte character, calculate the number of bytes ; If it is a single byte character, it is counted as a byte . such as : Letter , The array counts as a byte , Chinese means multiple bytes ( Related to character set encoding )
Use example 3
take EMP There are... In all the names in the table S Of is replaced by ’ - ’

Use example 4
Intercept EMP In the table ename The second to third characters of the field

Use example 5
Display the names of all employees in capital letters

Mathematical functions

- The absolute value

- Hexadecimal conversion

- integer

- Generate random numbers

Other functions
- user() Query current user

- md5(str) To a string md5 Abstract , After the summary, we get a 32 A string

md5(stri) It is often used in password encryption , The process is as follows

- database() Displays the database currently in use

- password() function ,MySQL The database uses this function to encrypt users

- ifnull(val1, val2) If val1 by null, return val2, Otherwise return to val1 Value

边栏推荐
- AGCO AI frontier promotion (6.30)
- The sci-fi ideas in these movies have been realized by AI
- Embedded sig | multi OS hybrid deployment framework
- R language ggplot2 visualization: gganimate package is based on Transition_ Time function to create dynamic scatter animation (GIF)
- 8253计数器介绍
- 海思3559开发常识储备:相关名词全解
- Go zero micro Service Practice Series (VIII. How to handle tens of thousands of order requests per second)
- Getting started with the go language is simple: go handles XML files
- Joplin实现样式更改
- 用宝塔建第2个网站时网站总是报错:No input file specified.
猜你喜欢

Paper interpretation (AGC) attributed graph clustering via adaptive graph revolution

ES6新特性介绍

Set集合

redis在项目中的使用

海思3559萬能平臺搭建:獲取數據幀修改後編碼

SuperMap iDesktop 常见倾斜数据处理全流程解析

beego开发博客系统学习(二)

Solve the problem that the server cannot be connected via SSH during reinstallation

Yolov5 export the pit encountered by onnx

3D线光谱共焦传感器在半导体如何检测
随机推荐
使用深度学习进行生物网络分析
How difficult is data governance and data innovation?
Multiparty cardinality testing for threshold private set-2021: Interpretation
Redis6学习笔记-第二章-Redis6的基本操作
time 函数和 clock_gettime()函数的区别
药店管理系统
Object mapping - mapping Mapster
Parallel interface 8255A
A High-Precision Positioning Approach for Catenary Support Components With Multiscale Difference阅读笔记
Go 语言入门很简单:Go 处理 XML 文件
Redis - SDS simple dynamic string
200. 岛屿数量
Talk about how to do hardware compatibility testing and quickly migrate to openeuler?
List collection
[cf] 803 div2 A. XOR Mixup
[cloud native | kubernetes] in depth understanding of deployment (VIII)
海思3559万能平台搭建:获取数据帧修改后编码
R language ggplot2 visual Facet: gganimate package is based on Transition_ The time function creates a dynamic scatter graph animation (GIF) and uses the labs function to add a dynamic time title to t
Shutter start from zero 006 radio switches and checkboxes
STM32 porting the fish component of RT thread Standard Edition