App Inventor 2 has only one TinyDB database. Users do have to provide an instance of the DB on each screen they use the data with. When you name a database tinydb2 , it uses the same tags as tinydb1 .
That is your problem. How about saving the students to a tag of students and the teachers to a tag of teachers?
Let us know what happens, keeping them separate using different tags should allow you to displays only the tinydb1 tags you want.
Gettags returns a list of ALL the tags in the data store. You have to use the GetValue block and store all the tags as a List instead of storing the studentNames as individual tags. Store as a List, then cycle through the retrieved list to display them perhaps.
Regards,
Steve