1
2
3
4
5 CREATE TABLE products(
6 productId INT AUTO_INCREMENT PRIMARY KEY,
7 productName varchar(100) not null,
8 categoryId INT NOT NULL,
9 CONSTRAINT fk_category
10 FOREIGN KEY (categoryId)
11 REFERENCES categories(categoryId)
12 ON UPDATE CASCADE
13 ON DELETE CASCADE
14) ENGINE=INNODB;