Vài câu lệnh cơ bản khi làm việc với Postgres
1. Chuyển sang database postgres. su - postgres 2. Sau đó vào database : psql 3. Vào cụ thể một database nào đó: psql database_name 4. Xem danh sách các database: postgres=# \l 5. Khi nào bạn vào 1 database cụ thể nào đó, bạn muốn xem sanh sách các list tables, views, and sequences: postgres=# \d 6. Nếu bạn muốn chỉ xem danh sách table: postgres=# \dt 7. Bạn muốn thay đổi password một user nào đó trong postgres: ALTER USER database_name WITH PASSWORD 'qwert12345'; 8. Tạo một database trong postgres. CREATE DATABASE database_name; 9. Xóa một database postgres: DROP DATABASE database_name; 10. Xem danh sách các user trong postgres. postgres=# \du 11. Xem tất cả các record trong một table: postgres=#SELECT * FROM table_name; 12. Update 1 record trong postgres: postgres=#UPDATE username='abcd' WHERE id=1; 13. Thoát khỏi console postgres: postgres=#\q