美文网首页
Postgresql关于数据库表信息查询sql语句(持续更新)

Postgresql关于数据库表信息查询sql语句(持续更新)

作者: 迷糊_ | 来源:发表于2016-09-18 14:42 被阅读1858次
    • 查询所有的数据库
      show databases;(mysql) select * from pg_database;(postgresql)

    • 查询数据库所有的表信息

    show tables;(mysql)
    select * from information_schema.tables where table_schema='public';(postgresql)
    
    • 查询数据库users表所有字段信息
    desc users;(mysql)
    select * from information_schema.columns where table_name='users';(postgresql)
    
    • 修改字段类型
      alter table "users" alter column created_date type timestamp;

    • 创建存储过程

    create or replace function updateTimeType() returns void as
    $body$
        declare
        begin
    
        end;
    $body$ language plpgsql;
    
    • 查询存储过程
      SELECT *from newprocedure();

    • 删除存储过程
      DROP FUNCTION newprocedure();

    相关文章

      网友评论

          本文标题:Postgresql关于数据库表信息查询sql语句(持续更新)

          本文链接:https://www.haomeiwen.com/subject/czxgettx.html