Postgre: Some useful command of Postgre

来源:互联网 发布:路径动画导入unity3d 编辑:程序博客网 时间:2024/05/16 19:32

Postgre is a SQL like database. However, there are some difference between it and MySQL in the perspective of command. 


1) show tables <==> \dt


Or use the select sentence: 


SELECT * FROM pg_catalog.pg_tables


2) show databases <==> \l


Or use the select sentence: 


select datname from pg_database;


3) Delete all the rows of a table:


DELETE FROM tablename;


If you need to have a filter: 


DELETE FROM weather WHERE city = 'Hayward';


4) Switch to another dataset


\c databasename

0 0
原创粉丝点击