0

I have a database that consists of many tables that contain data on a resident. the table is separated by year of birth and month. for example those born in 01 of 1980, then the data is stored with the name table table_8001, and so on.

so I will create a searching function by inputting a resident id or name.

how to make a searching using many of these tables?

rzl21
  • 43
  • 1
  • 7
  • 1
    Kindly explain us more about your request. There are many ways of handling the data from database-. Please make sure you explain your db structure and in which you are trying to approach. By the way the above approach is not advisable and will have adverse effect on the database, since a single query will travel all the database. You need a better architecture design for the database. Try sharing as much info as possible, probably someone will help you in redesigning the db architecture. – mightyteja Feb 12 '19 at 04:06

1 Answers1

0

If I understand correctly, you have multiple tables based on particular yearly groupings.

You can use laravel package to accomplish this

OR

You can use mysql union for accomplishing the same. See this thread

However, this architecture will be exponentially increasing the table structures as time goes by. It is not efficient to search from multiple tables.

You can create a mysql view and create separate model to search the resident which points to that view.

MySQL is capable of handling large set of data in a single table is structured and indexed properly. :)

Mihir Bhende
  • 8,677
  • 1
  • 30
  • 37