sara sara - 1 year ago 65
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

Answer Source

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'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download