Multiple data bases

Hello! I am trying to build a quiz app and I have the following question: how can I create a button that selects what database the questions are from?
What I mean is, if I press history it shows me history questions, if I choose math is shows me math questions etc.
Is there any possible way to do this?