Home  >  Article  >  Database  >  mysql 动态表创设

mysql 动态表创设

WBOY
WBOYOriginal
2016-06-07 16:25:28994browse

mysql 动态表创建 mysql 动态表创建 ,首先要检测是否存在。 使用sql语句: ? ? 1. SHOW ? TABLES ? LIKE ? '%tb_bp_d_case%';?? 2. select `TABLE_NAME` from `INFORMATION_SCHEMA`.`TABLES` where `TABLE_SCHEMA`='dbname'?and `TABLE_NAME`='tablename'?;

mysql 动态表创建

mysql 动态表创建 ,首先要检测是否存在。

使用sql语句:

?

?

1. SHOW ? TABLES ? LIKE ? '%tb_bp_d_case%';??
2. select `TABLE_NAME` from `INFORMATION_SCHEMA`.`TABLES` where `TABLE_SCHEMA`='dbname'?and `TABLE_NAME`='tablename'?;
3. 如果表不存在就建立这个表,那么可以直接用?create?table?if?not?exists?tablename?这样的指令来建立,不需要先去查询表是否存在。
4. 从模板表创建表:create table if not exists like old_table_name? (目前使用的是这个)

根据区域划分表来拆分数据。

?

?

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