Check out example codes for "create table postgresql foreign key". It will help you in understanding the concepts better.

Code Example 1

CREATE TABLE so_items (
	so_id INTEGER,
  	...
	FOREIGN KEY (so_id) REFERENCES so_headers (id)
);

Learn ReactJs, React Native from akashmittal.com