The Design of the column about articles in the Field of MySQL Database

We have a news APP, with news and video columns, or corresponding website columns, these columns are different. It is expected that an article or video is placed in a table, and the column page is placed in a table. Where:

1. The column table uses a field to distinguish whether the column is website, APP video, or APP news.
2. Use a field in the content table to distinguish between video and news. The
menu column table may be as follows:

contentAPP"" "" content
content:

now, what kind of field do I need to add to my content to indicate which column my news or video belongs to (it may belong to multiple columns at the same time)? it is expected that there may be a varchar field channel, for example, the saved value of "1Person3Mague 5" indicates that it belongs to these columns, but in this case, it may not be very convenient for later retrieval, because content often has to search, and you can only use like fuzzy search. Do you have any good ideas? thank you for your advice!

Apr.12,2021

if you are not allowed to use only two tables, the normal operation of a many-to-many relationship should be to store another table.
for example, add a tag table to establish a relationship between menu.id and content.id .

in this way, you can do one more step of table join when you use it


can be expressed in bits. An int can express 32 columns,
for example

SELECT * FROM content WHERE `type`=POW(2,0)|POW(2,2)

you can find out the news belonging to column 1BI 3

Menu