Home  >  Article  >  Database  >  How to generate random numbers and concatenate strings in MySQL

How to generate random numbers and concatenate strings in MySQL

小云云
小云云Original
2018-01-13 14:15:421679browse

This article mainly introduces the method of generating random numbers and connecting strings in MySQL, briefly analyzes the related functions, and gives the corresponding SQL statement implementation method in the form of examples. Friends who need it can refer to it. I hope it can help everyone. .

Methods used:

concat('a','b','c'); Connection string

rand(); Generate random numbers

##floor(); Get integers

SQL statement examples

UPDATE user set reg_ip= concat(floor(RAND() * 250),'.',floor(RAND() * 250),'.',floor(RAND() * 250),'.',floor(RAND() * 250)) where username='xxx'

Related recommendations:


php rand() function for random number generation

php five ways to generate random numbers without repeating

JavaScript implementation of random number deduplication generator example

The above is the detailed content of How to generate random numbers and concatenate strings in MySQL. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn