You can have one TinyDB, containing more than one namespace, to logically arrange stored values. See an example using a Multi-Namespace TinyDB by @ChrisWard
If you have more than one screen and you want every screen or some screens use the data from the others, you can set the namespace to the same. Every TinyDB that haves the same namespace acess the same data. A TinyDB which haves a different namespace than others have different data.
So I think we can basically say that tinyDB's having the same namespaces sync to each other to store totally the same data under their respective tag.
Although I have some questions:-
Can one TinyDB have multiple namespaces?
a) If the answer Is Yes, why do we need to create different/multiple TinyDB's?
b) If the answer is No, why do we need to have namespaces if we can store all the data in just
one TinyDB rather than syncing data from multiple DB's?
Please clear my confusion and also a suggestion to keep this discussion forever visible to everyone as this concept gets really confusing to newbies.
Which is what I said. It is about being able to drag out another component. Don't over think this.
TinyDB is the same database, no matter how many tinydb components you drag out on how many screens.
If you set different namespaces, then you will have different storage containers. You must remember to set the namespace, every time, before trying to get at its contents!
Maybe it would make sense to get a bit of history to understand how it works. In earlier versions of App Inventor, TinyDB only ever wrote to the same backing file (TinyDB1.xml). This was useful for persisting data across app restarts and passing data between screens, since every instance of TinyDB in the app would read/write the same backing store.
However, we also observed that many people were surprised by the fact that if they create multiple TinyDBs on the same screen that data would randomly "appear" in one TinyDB written to another. Conceptually people expected these different TinyDBs to be backed by different data stores and not share the same data.
We introduced the Namespace property to address the confusion around having multiple TinyDB instances on the same screen. While they still initialize Namespace to "TinyDB1" to simulate the old behavior, you can change the Namespace property to store data in a new file (<namespace>.xml). For example, if you change Namespace to be "People", then you'll end up with a "People.xml" file. and so forth. For two TinyDB (same screen or different) to manipulate the same data, they need to have the same Namespace property. You can programmatically set the Namespace, so even if you have one instance of the TinyDB component it can write to many different backing files. Or you can have many TinyDB each with a fixed Namespace property.