「已注销」 2022-12-23 00:19 采纳率: 0%
浏览 38
已结题

删除数据库test1下所有前级为tmp的表?

查询原表名、列名、列类型等信息的操作是什么?如何操作删除数据库test1下所有前级为tmp的表?

  • 写回答

2条回答 默认 最新

  • AllenGd 领域专家: 大数据技术领域 2022-12-23 09:03
    关注
    SELECT
        *
    FROM
        information_schema.COLUMNS 
    WHERE
        table_schema = (
    SELECT DATABASE
        ());
    select concat_ws (table_name,'drop table test1.',';') from information_schema.COLUMNS
    where table_schema = 'test1' and table_name like 'tmp%';
    
    评论 编辑记录

报告相同问题?

问题事件

  • 系统已结题 12月31日
  • 已采纳回答 12月23日
  • 创建了问题 12月23日