Database schema design for referral system ( multi level) with real-world use case explanation and query examples
Hi Mr.HERRY GUNAWAN. Thank you for your sharing. It's really helpful for me. However, I have a concern about the in this query:
WHERE
hierarchy LIKE concat('1.3.4.%')
OR hierarchy = '1.3.4';
Why do we need to use Or hierarchy='1.3.4' in this case? I'm a newbie. Could you help to explain it for me? Thank you
Actually, it's depend on the usecases
In the usecase it requires me to query the `1.3.4` and the descendant. Using statement `LIKE '1.3.4%'` was not possible because, for example 1.3.42 should not valid.
Hi Mr.HERRY GUNAWAN. Thank you for your sharing. It's really helpful for me. However, I have a concern about the in this query:
WHERE
hierarchy LIKE concat('1.3.4.%')
OR hierarchy = '1.3.4';
Why do we need to use Or hierarchy='1.3.4' in this case? I'm a newbie. Could you help to explain it for me? Thank you
Actually, it's depend on the usecases
In the usecase it requires me to query the `1.3.4` and the descendant. Using statement `LIKE '1.3.4%'` was not possible because, for example 1.3.42 should not valid.