mysql按前缀搜索表_mysql查找一个数据库中所有特定前缀的表

在MySQL中,可以使用information_schema.tables表来查询特定前缀的表。例如,以下查询将返回'test'数据库中所有表名以'test_'开头的表,按表名降序排列。
摘要由CSDN通过智能技术生成

匿名用户

1级

2013-03-27 回答

php 不会。

mysql 里面, 查询 表的信息, 我倒是会的。

是从 information_schema.tables 这里查询的。

下面是一个例子:

mysql> SELECT table_name, table_type, engine

-> FROM information_schema.tables

-> WHERE table_schema = 'test'

-> ORDER BY table_name DESC;

-> //

+--------------------+------------+--------+

| table_name | table_type | engine |

+--------------------+------------+--------+

| v_sale_report_x | VIEW | NULL |

| v_sale_report | VIEW | NULL |

| union_tab_2 | BASE TABLE | InnoDB |

| union_tab_1 | BASE TABLE | InnoDB |

| test_trigger_table | BASE TABLE | InnoDB |

| test_tab2 | BASE TABLE | InnoDB |

| test_tab | BASE TABLE | InnoDB |

| test_main | BASE TABLE | InnoDB |

| test_dysql | BASE TABLE | InnoDB |

| test_create_tab4 | BASE TABLE | InnoDB |

| test_create_tab2 | BASE TABLE | InnoDB |

| test_create_tab1 | BASE TABLE | InnoDB |

| test_create_tab | BASE TABLE | InnoDB |

| sale_report | BASE TABLE | InnoDB |

| log_table | BASE TABLE | InnoDB |

+--------------------+------------+--------+

15 rows in set (0.02 sec)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值