Home  >  Article  >  Database  >  How to dynamically generate tables in mysql

How to dynamically generate tables in mysql

coldplay.xixi
coldplay.xixiOriginal
2020-10-09 15:49:283281browse

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>

$ 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!

Statement:
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