My Blog List

Wednesday, November 12, 2014

Thinking about multi reply table in oracle~!



In these days, people want to spend their more time with mobile than Pc.
Pc resolution is very high. so it is very readable in short time.
Mobile resolution size is smaller than PC. so paradigm of design is simple.
It seems that people like if something is so simple.
what I want to say is multi reply system is not many used in these days.

but I have to know how to think and make table for multi reply in board.

one way : 


column : id
subcolumn : parent id, title

Id is unique value
and parent id indicate Id
and more and more

this architecture can make limitless depth replies.

query can express by using oracle grammer connect by


In my opinion

advantage : formal and readable
disadvantage : many article, connect by spend much time to query



the other recommendable way : 

column : id
subcolumn : order_id, title, root_comment_id, depth


I want to show you ex)..

id                                   title,        depth  depth_order     root_comment_id
00000000001               root title            0     1                   00000000001  
00000000002                title                1       1                   00000000001  
00000000003                title               2        1                   00000000001
00000000004                title               2        2                   00000000001 
00000000005                root title         0        1                  00000000002 


select * from table order by root_comment_id desc, depth asc, depth_order desc


Anyway there are lots of way you can make.

what kind of way to choose is up to you~!


 

No comments:

Post a Comment