Are they stored in database? Why I couldn't see them in my database tables?

And how the ID is generated? it seems category and product can have same ID.

Thanks.