Insert multiple rows into a table in MariaDB/MySQL

For testing insert multiple rows into table in MySQL or MariaDB

Following are the commands to create a table and insert multiple data through a procedure in MySQL or MariaDB for testing:

  1. Create a table with name TEST.

create table test (
id int not null auto_increment primary key,
name1 varchar(10)


2. Create a procedure with Procedure Name PN

delimiter $$
create or replace procedure proc_insert (in p_range int)
declare i int default 0;
while i < p_range do
insert into test (name1) values (concat('1d',i));
set i = i + 1;
end while;
end $$
delimiter ;

3. Insert the rows by calling the procedure if you want to enter 10000 rows then pass 10000 as parameter value.

call proc_insert(10000);