Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

  1. 相当与mysql的show databases;
select datname from pg_database;    
  1. 相当于mysql的show tables;
SELECT table_name FROM information_schema.tables WHERE table_schema = 'public';   

public 是默认的schema的名字

  1. 相当与mysql的describe table_name;
SELECT column_name FROM information_schema.columns WHERE table_name ='table_name';  

'table_name'是要查询的表的名字