Sometimes your components may need to use Joomla's Categories feature. I am not talking about using content categories, where articles are placed in. I am talking about having Joomla manage categories for your own items. This is what Joomla itself is doing for its core components like Contacts and Banners.
Using Joomla's categories instead of inventing your own categorisation has many benefits. The obvious benefit is that users are exposed to a familiar and consistent category management interface. Beyond the obvious, this is the only way you can have nice things such as integration with custom fields.
Your table which contains the items which go into each category needs to have a few columns:
`id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT 'Item unique ID', `catid` BIGINT(20) NOT NULL COMMENT 'Category ID', `state` TINYINT(3) NOT NULL DEFAULT '1' COMMENT 'Publish status',
These fields don't necessarily need to have these names; we can change them in the code. However, these column names are the default used in Joomla and it makes it easier for you to follow third party tutorials and for other people to follow what you are doing with your code.