Constraints are rules the database enforces on every insert and update, so bad data is stopped at the door instead of cleaned up later:
CREATE TABLE product_reviews (
review_id INTEGER PRIMARY KEY,
product_id INTEGER NOT NULL REFERENCES products (product_id),
rating INTEGER CHECK (rating BETWEEN 1 AND 5),
status VARCHAR NOT NULL DEFAULT 'pending'
);
PRIMARY KEY: unique and never NULL. A key can span columns: PRIMARY KEY (customer_id, product_id).
UNIQUE: no two rows share the value (several NULLs are allowed).
NOT NULL and DEFAULT: required values, and what to store when the insert leaves the column out.
CHECK (condition): any rule about the row's own values.
REFERENCES (a foreign key): the value must exist in the other table's key.
PostgreSQL, MySQL and SQL Server also support ON DELETE CASCADE on foreign keys, which deletes child rows with their parent; the database here does not. The check runs probe inserts against your table, so the rules must really be enforced, not just written in a comment.