当前位置:网站首页>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

边栏推荐
- A Generic Deep-Learning-Based Approach for Automated Surface Inspection-论文阅读笔记
- Generate entity classes from SQL Server database tables through EF core framework
- Pinda general permission system (day 7~day 8)
- 光谱共焦位移传感器的原理是什么?能应用那些领域?
- 拆分电商系统为微服务
- 200. number of islands
- 智慧法院新征程,无纸化办公,护航智慧法院绿色庭审
- 1175. prime number arrangement: application of multiplication principle
- A review of quantum neural networks 2022 for generating learning tasks
- Object mapping - mapping Mapster
猜你喜欢

Use of redis in projects

A high precision positioning approach for category support components with multiscale difference reading notes

Embedded SIG | 多 OS 混合部署框架

Set集合

Joplin实现样式更改

3D线光谱共焦传感器在半导体如何检测

How can c write an SQL parser

使用深度学习进行生物网络分析

如何使用插件化机制优雅的封装你的请求hook

Biological network analysis using deep learning
随机推荐
The website with id 0 that was requested wasn‘t found. Verify the website and try again
Redis的配置文件及新数据类型
Hannaiping of Qilin software: the construction of Digital China needs its own open source root community
Subtrate 源码追新导读-5月上旬: XCM 正式启用
1020. 飞地的数量
90.(cesium篇)cesium高度监听事件
剑指 Offer 05. 替换空格: 把字符串 s 中的每个空格替换成“%20“
List collection
Hisilicon 3559 developing common sense reserves: a complete explanation of related terms
Flutter 从零开始 007 输入框
STM32 porting the fish component of RT thread Standard Edition
qt msvc 安装及调试
Achieve secure data sharing among multiple parties and solve the problem of asymmetric information in Inclusive Finance
How can c write an SQL parser
品达通用权限系统(Day 7~Day 8)
视频按每100帧存一个文件夹,处理完再图片转视频
STM32 移植 RT-Thread 标准版的 FinSH 组件
A Generic Deep-Learning-Based Approach for Automated Surface Inspection-论文阅读笔记
移除无效的括号[用数组模拟栈]
海思3559 sample解析:venc