Home > Database > Mysql Tutorial > body text

How to dynamically generate tables in mysql

coldplay.xixi
Release: 2020-10-09 15:49:28
Original
3278 people have browsed it

Mysql method of dynamically generating tables: Use sql statements to implement, the code is [create table ${name} (id varchar(36) primary key], [$] represents the table, and name means passed in through map Parameters.

How to dynamically generate tables in mysql

##Mysql method of dynamically generating tables:

This project is an express project, because express delivery every day There are a lot of express delivery, so if all the data is stored in one table, the table will become bloated over time. Therefore, tables need to be created dynamically.

How to write sql statements:

    <select  id = "creatTable">
             create table ${name}(id varchar(36) primary key , temp1  varchar(10) , temp2  varchar(10))
    </select>
Copy after login

$ represents the table, name refers to the parameters passed in through map, here refers to the name of the table that needs to be dynamically created.

Related free learning recommendations:

mysql database (video )

The above is the detailed content of How to dynamically generate tables 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template