There are a few special sql commands that I used often recently, mark them here.
1: Show all the columns' name
SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='yourtablename';
another solution
\d 'yourtablename'
2: Show the primary key:
SELECT pg_attribute.attname, format_type(pg_attribute.atttypid, pg_attribute.atttypmod) FROM pg_index, pg_class, pg_attribute WHERE pg_class.oid = 'nygeotwitters'::regclass AND indrelid = pg_class.oid AND pg_attribute.attrelid = pg_class.oid AND pg_attribute.attnum = any(pg_index.indkey) AND indisprimary;