Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to kind of emulate a folder structure in my application. Now I've thought of two ways to achieve this, but what is the best practice for that?

Table: Attachments

Columns: Id (PK), ParentId (FK), Name, FileContent, IsFolder


Table: Attachments

Columns: Id (PK), FolderId (FK), FileContent

Table: AttachmentFolders

Columns: Id (PK), Name

share|improve this question
This has been discussed many times. For example:… – RLF Sep 16 '13 at 15:15
What are your requirements? Are folders hierarchical? Can folders move? Can files move? What do you need to retrieve fast? How many files/folder? How many folder? Skew? – Remus Rusanu Sep 16 '13 at 15:16
Yes, just like any other filesystem: File/Folder move, rename, delete, update should be possible. What do I need to retrieve fast? All of it. How many files? n. – SeToY Sep 16 '13 at 15:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.