How to generate random numbers and concatenate strings in MySQL

小云云
Release: 2018-01-13 14:15:42
Original
1601 people have browsed it

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'
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!