This article uses an example to describe how to create a stored procedure in MySQL and add records in a loop. Share with you for your reference, the details are as follows: First create, then call: -- Create stored procedure DELIMITER; // create procedure myproc() begin declare num int; set num=1; while num <= 24 do insert into t_calendar_hour(hourlist) values(num); set num=num+1; end while; commit; end;// -- Call the stored procedure CALL myproc(); PS: Here are two commonly used SQL online tools for your reference (including SQL statement usage instructions): SQL online compression/formatting tool: SQL code online formatting and beautification tool: Readers who are interested in more MySQL-related content can check out the following topics on this site: "MySQL stored procedure skills", "MySQL common function summary", "MySQL log operation skills", "MySQL transaction operation skills summary" and "MySQL database lock related skills summary" I hope this article will be helpful to everyone's MySQL database design. You may also be interested in:
|
<<: Example of how to reference environment variables in Docker Compose
>>: Fabric.js implements DIY postcard function
1. What is As a markup language, CSS has a relati...
Using the CSS3 border-image property, you can set...
Write a SQL first SELECT DISTINCT from_id FROM co...
Let's take a look at the command to restart t...
1. Introduction In the past, if you wanted to sta...
Table of contents summary Problem Description Ana...
When installing in MySQL 8.0.16, some errors may ...
1. Download MySQL Log in to the MySQL official we...
1.ssh command In Linux, you can log in to another...
1. Always close HTML tags In the source code of p...
illustrate In front-end development, you often en...
Table of contents 1. Unzip 2. Create a data folde...
You can use the command: docker tag [image id] [n...
This article describes the definition and usage o...
What is JConsole JConsole was introduced in Java ...