I have many data types which are very similar, except for a small number of columns which logically have different names (but the same data types). I want to store everything in one table.
Right now my idea is simply to give a generic name to some of the columns (e.g. “custom_data_1” etc.) and in a different table remember for each data type what its column names are. This should work, but I wonder if there’s a more structured way (that will make queries easier and will feel less dirty) to achieve the same effect (in MySQL or SQLite).
If you are storing different things, you should store them in different tables. You can then later create a view to have something that’s easy to query.
The advantage is that each table has its own objects, and you can easily add/remove/rename columns to it. What if your type1 needs 2 extra columns, but type2 actually loses a column?