Can I create a table on my DB without creating a plugin?

When I started out with WordPress I was anti-plugin. I wanted to add everything in my theme’s functions.php. When I looked at the bigger picture it began making sense having and leaving some functionalities inside a plugin.

There are many write-ups on the subject of what should go into a plugin and what should go into a theme. I, for one, have done one or two posts on this subject, so do yourself the favor and read up on this. I believe it will be very helpful and insightful.

Functions in a plugin and functions in a theme’s functions.php does exactly the same job, there is no difference. The only thing is, you cannot declare a function in plugin and redeclare it in your theme. This will throw a fatal error crashing the site

To answer your issue, yes, if you think logically about this, your functionality should go into a plugin as this gives functionality to your site, and not the theme. This is functionality that you would need when you switch themes. It is just easier in plugin as you don’t need to write or copy this code over and over again into a new theme.

But the choice is still yours. Adding it to your theme is your own choice, although, as I said, not really recommended. But either way, the code will work perfectly fine in a theme and in a plugin, so the choice is yours to make where to add it