From a customer perspective, it is useful to be able to narrow down your catalogue by viewing products by category, such as shoes, shirts, coats, and so on. If you wish to add this functionality, you'll need to amend the database. If you require this feature, copy the code in the following Getting ready section.
In order to support searching and filtering by categories, we'll need to add a categories table. If you haven't already done this during the Getting ready section earlier in the chapter, create the following table in your database:
CREATE TABLE IF NOT EXISTS `categories` ( `cat_id` int(11) NOT NULL AUTO_INCREMENT, `cat_name` varchar(50) NOT NULL, PRIMARY KEY (`cat_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3; INSERT INTO `categories` (`cat_id`, `cat_name`) VALUES (1, 'Shirts'), (2, 'Footware');