pogresql基础学习笔记

命令行工具:psql

可视化工具:pgAdmin

查看所有表:

  命令行:d

  sql:select * from pg_tables WHERE schemaname='public';

查看表结构:

  命令行:d table_name

  sql:太麻烦

 创建函数(存储过程):

CREATE OR REPLACE FUNCTION totalRecords ()  
RETURNS integer AS $total$  
declare  
    total integer;  
BEGIN  
   SELECT count(*) into total FROM EMPLOYEES;  
   RETURN total;  
END;  
$total$ LANGUAGE plpgsql;

  使用:select totalRecords();

  

原文地址:https://www.cnblogs.com/adeng/p/7245056.html