How to create one table which shares common id with another and which row gets removed in both tables once it's removed from first?
I heard about FOREIGN KEY, REFERENCES but not sure how to actually create such tables. Any example to get me started?
I think you're either talking about a cascading delete or something really weird that you shouldn't do. :)
Info on foreign keys: http://www.postgresql.org/docs/8.3/static/tutorial-fk.html
Info on cascading deletes (search the page for "ON DELETE CASCADE"): http://www.postgresql.org/docs/8.2/static/ddl-constraints.html
Edit: adding example:
Table creation:
Example of triggering cascading delete: