When logging in to the stress test, many different users are required, and new data needs to be added to the database #Batch add user accounts - stored procedure: delimiter // drop procedure if exists test; create procedure test() begin DECLARE i int; set i = 1; while i<21 do insert into hg_user values (concat("OM_TEST",cast(i as CHAR)),concat("OM_TEST",cast(i as CHAR)),"F1B2F5B9FBC8B513",null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null); set i = i+1; end while; select * from test; end// call test(); delimiter is the MySQL delimiter. The default delimiter in the MySQL client is a semicolon (;). If you input more statements at one time and there is a semicolon in the middle of the statement, you need to specify a special separator, commonly used ones are // and &&. The above is, first set the separator to //, The statement is not executed as a whole until the next // is encountered. After execution, the last line, delimiter; resets the MySQL delimiter to a semicolon. If not modified, all separators in this session will be based on //. concat is a character concatenation, which connects multiple strings into one string. Syntax: concat(str1, str2,...)
The cast function is used to explicitly convert an expression of one data type to another data type. Syntax: CAST (expression AS data_type) There are restrictions on the types that can be converted. The type can be one of the following values:
Batch deletion solution (the same applies to deleting users) #Delete solution - stored procedure; delimiter // drop procedure if exists test; create procedure test() begin DECLARE i int; set i = 1; while i<11 do DELETE from hg_application_flow_template where user_name=concat("OM_TEST",cast(i as CHAR)); DELETE from hg_application_flow_template_details where created_by=concat("OM_TEST",cast(i as CHAR)); set i = i+1; end while; select * from test; end// call test(); Summarize This is the end of this article about MySQL batch addition and storage. For more relevant MySQL batch addition and storage content, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: How to hide the border/separation line between cells in a table
>>: Vue complete code to implement single sign-on control
Table of contents introduction 1. Case Overview 2...
The reason is simple: In HTML documents, multiple ...
The Linux command to run the jar package is as fo...
A reader contacted me and asked why there were pr...
By default, the width and height of the header ar...
Table of contents 1. Get the first link first 2. ...
We live in a visual world and are surrounded by m...
Preface Query optimization is not something that ...
1. View openjdk rpm -qa|grep jdk 2. Delete openjd...
Overview Databases generally execute multiple tra...
Table of contents Use of CURRENT_TIMESTAMP timest...
Platform deployment 1. Install JDK step1. Downloa...
Here is a single-line layout using ul>li for l...
1. Absolute path First of all, on the local compu...
1. Command Introduction nl (Number of Lines) adds...