• 技术文章 >常见问题 >Python常见问题

    如何判断postgresql表是否存在

    silencementsilencement2020-02-12 14:36:10原创2159

    postgresql判断一个表是否存在:

    方法一:

    select count(*) from pg_class where relname = 'tablename';

    方法二:

    select count(*) from information_schema.tables where table_schema='public' and table_type='BASE TABLE' and 
    table_name='tablename';

    推荐学习《Python教程》。

    专题推荐:数据库
    品易云
    上一篇:运行python文件失败怎么办 下一篇:如何打开python的项目

    相关文章推荐

    • postgresql大小写有什么好处• 怎么启动postgresql

    全部评论我要评论

    © 2021 Python学习网 苏ICP备2021003149号-1

  • 取消发布评论
  • 

    Python学习网