If I want multiple items in a single entry in a DB, I'm guessing I have to store it as Json?

Follow

@pasture I want to store a list in a single cell in SQLite

· · Web · 1 · 0 · 0

@matrix I think, and I could be wrong, normally one would use a separate table and link each item to an owner using foreign keys

@matrix You generally don't want a comma-delineated list of strings because you can't directly query against that.

For example, let's say we're writing an imageboard, and the list is of tags. You might want to find or count everything with that tag, but it'd be more difficult to look through each item individually rather than just querying against the table.

@pasture Yeah, I get that for querying, it's really bad, but it's just 4 items and I won't be querying them

@matrix I mean, a comma-separated list of items may be perfect for your use case, but consider the debt that brings if you ever want to try to create complex queries against that column. 🤷‍♀️

Sign in to participate in the conversation
Game Liberty Mastodon

Mainly gaming/nerd instance for people who value free speech. Everyone is welcome.