您的位置:首页 > 其它

Postgre: Some useful command of Postgre

2016-03-10 15:38 176 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息