Postgre: Some useful command of Postgre

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

你可能感兴趣的:(show,show,postgre,databases,tables)