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();

 

 

 

  

posted @ 2017-07-27 15:20  练好本领,报国杀敌  阅读(182)  评论(0编辑  收藏  举报