sara sara - 4 months ago 12
MySQL Question

Which database method should I take to collect my monthly information

I have information to be collected monthly. same data columns but different content of course. I'm asking about which are the best way to make the user insert this data, should I make a database table for each month with the same columns, or should I make one table with one column to determine the month.

For example:

table: July

table: June


table: monthly_info

I'm asking which way is more efficient than the other.
Thank you


Create one table to save all your data with date.

table: monthly_info

Then you can query monthly data as below.

If your condition month parameter is integer. Use this query. (this will return all data matches to month August)

SELECT * FROM monthly_info WHERE MONTH(date) = 8

If your condition month parameter is string. Use this query.

SELECT * FROM monthly_info WHERE DATENAME(mm, date) = 'August'