mysql - SQL different table or store as text in same table -


i have dilemma can't seem put rest.

on page have list of objects. each of objects slider - aribnb - https://www.airbnb.com/s/london--united-kingdom?source=ds

in db store information object (it has other info except slides), i'm thinking, easiest store url slides block of text.

url       | other_field ----------------------- url1,url2 | other stuff  

then handle there in either front end or backend converting them array etc.

the second approach create separate table i'd store each url , id of object url belongs on separate row

url  | obj_id ------------- url1 | id1 url2 | id1 url3 | id2 ............. 

. i'd group_concat( distinct x) , return them me block of text. i'd same thing splitting them up.

long story short, store them field in initial table or in separate table, each being it's own row. advantages , disadvantages either approach? me seems easier have them text in same table, i'm inexperienced in this, need advice.

edit: final usable format json slides being either array, or text split array @ appropriate time.

the answer is... depends. if think of urls notes in block of text, maybe makes sense store them in 1 field. make sure set field length large enough.

however, if think ever might need treat url relational entity... need go second route. mean that? well, if in future need add requirement store not url short description of it? maybe need add active date tell when last time url checked valid. maybe able find objects share common url. i'm not saying these should requirements; i'm saying don't know future requirements be. if you're block of text , block of text, sure... put in varchar(max) field. down road though requirements built on, you'll tempted try hack more stuff blob of text, make things more difficult going forward.

sometimes it's appropriate break normal form speed or simplicity, want sparingly , forethought future possible.


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -