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

  • 查询所有的数据库
    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();

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容