R
R
Roman Peterson2017-05-04 14:32:59
SQL
Roman Peterson, 2017-05-04 14:32:59

Are cross-table ids a bad idea?

I will have a tree structure of objects. There will be a nodes (id, parentId, type) table that defines the actual tree and data tables, such as users (id, name, email) or houses (id, address). So, I want the id of the data tables to strictly match the id of the nodes. I don’t have much experience in the database, I can’t understand if this is a good idea, how it will turn out for me and how the pros do it.
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Fedorov, 2017-05-04
@nochnoy

In general, creating cross-table identifiers is a normal practice, another question is whether this approach is suitable for your task. It's hard for me to judge. I do not understand what you are doing and what are your requirements. But judging by the nodes table, you don’t really need a relational database to solve your problem, so look towards document-oriented databases

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question