The following example creates a dbdemo database and two tables: categories and products . Each category has one or more products and each product belongs to only one category. The cat_id field in the products table is defined as a foreign key with UPDATE ON CASCADE and DELETE ON RESTRICT actions.