lundi 1 juin 2015

In SQL, what is the memory-efficient way of "mapping" 1 ID to multiple IDs?

I'll describe my scenario so you guys understand what type of design pattern I'm looking for.

I'm making an application where I provide someone with a link that is associated with one or more files. For example, someone needs somePowerpoint.ppx, main.cpp and somevid.mp4, and I have a tool that makes kj13h1djdsja213j1hhadad9933932 associated with those 3 files so that I can give someone

http://ift.tt/1FPtoxm

and they'll get a list of those files that they can download individually or all at once.

Since I'm new to SQL, the only way I know of doing that is having my tool use a table like

     fid                        |          filename
------------------------------------------------------------------
kj13h1djdsja213j1hhadad9933932            somePowerpoint.ppx
kj13h1djdsja213j1hhadad9933932            main.cpp
kj13h1djdsja213j1hhadad9933932            somevid.mp4
jj133823u22h248884h4h24h01h232            someotherfile.someextension

to go along with the above example. It would be nice if I could do some equivalent of

     fid                        |          filename(s)
---------------------------------------------------------------------------
kj13h1djdsja213j1hhadad9933932      somePowerpoint.ppx, main.cpp, somevid.mp4
jj133823u22h248884h4h24h01h232            someotherfile.someextension

but I'm not sure if that's possible or if I should be using some other design pattern altogether.

Any advice?

Aucun commentaire:

Enregistrer un commentaire