Questions tagged [data-modeling]

Data modeling questions refer to the techniques used to gather and analyze data requirements needed to support data operations in programs and systems.

Data modeling consist of gathering requirements and knowledge about the data needed to solve a given problem, and elaborating abstract data structures for the purpose of designing and implementing standardised data formats, databases and data processing systems.

Data-modeling is a specialized kind of modeling solely focused on passive data structures, and independent of the description of the processing of that data.

3039 questions
881
votes
15 answers

What's the difference between identifying and non-identifying relationships?

I haven't been able to fully grasp the differences. Can you describe both concepts and use real world examples?
338
votes
6 answers

Recommended SQL database design for tags or tagging

I've heard of a few ways to implement tagging; using a mapping table between TagID and ItemID (makes sense to me, but does it scale?), adding a fixed number of possible TagID columns to ItemID (seems like a bad idea), Keeping tags in a text column…
dlamblin
  • 43,965
  • 20
  • 101
  • 140
259
votes
6 answers

What's the longest possible worldwide phone number I should consider in SQL varchar(length) for phone

What's the longest possible worldwide phone number I should consider in SQL varchar(length) for phone. considerations: + for country code () for area code x + 6 numbers for Extension extension (so make it 8 {space}) spaces between groups (i.e. in…
250
votes
17 answers

What's the best way to model recurring events in a calendar application?

I'm building a group calendar application that needs to support recurring events, but all the solutions I've come up with to handle these events seem like a hack. I can limit how far ahead one can look, and then generate all the events at once. Or I…
Clinton Dreisbach
  • 7,732
  • 6
  • 29
  • 27
183
votes
4 answers

Data Modeling with Kafka? Topics and Partitions

One of the first things I think about when using a new service (such as a non-RDBMS data store or a message queue) is: "How should I structure my data?". I've read and watched some introductory materials. In particular, take, for example, Kafka: a…
David J.
  • 31,569
  • 22
  • 122
  • 174
178
votes
24 answers

What should I name a table that maps two tables together?

Let's say I have two tables: Table: Color Columns: Id, ColorName, ColorCode Table: Shape Columns: Id, ShapeName, VertexList What should I call the table that maps color to shape? Table: ??? Columns: ColorId, ShapeId
devuxer
  • 41,681
  • 47
  • 180
  • 292
159
votes
8 answers

What is the most efficient way to store tags in a database?

I am implementing a tagging system on my website similar to one stackoverflow uses, my question is - what is the most effective way to store tags so that they may be searched and filtered? My idea is this: Table: Items Columns: Item_ID, Title,…
Logan Serman
  • 29,447
  • 27
  • 102
  • 141
136
votes
15 answers

Are soft deletes a good idea?

Are soft deletes a good idea or a bad idea? Instead of actually deleting a record in your database, you would just flag it as IsDeleted = true, and upon recovery of the record you could just flag it as False. Is this a good idea? Is it a better idea…
001
  • 62,807
  • 94
  • 230
  • 350
104
votes
7 answers

Crow's Feet - One vs One And Only One

What is the difference between ONE: ONE AND ONLY ONE:
Atron Seige
  • 2,783
  • 4
  • 32
  • 39
97
votes
4 answers

How to implement has_many :through relationships with Mongoid and mongodb?

Using this modified example from the Rails guides, how does one model a relational "has_many :through" association using mongoid? The challenge is that mongoid does not support has_many :through as ActiveRecord does. # doctor checking out…
Mario Zigliotto
  • 8,315
  • 7
  • 52
  • 71
96
votes
17 answers

Firestore: How to get random documents in a collection

It is crucial for my application to be able to select multiple documents at random from a collection in firebase. Since there is no native function built in to Firebase (that I know of) to achieve a query that does just this, my first thought was to…
Garret Kaye
  • 2,412
  • 4
  • 21
  • 45
82
votes
7 answers

Why many refer to Cassandra as a Column oriented database?

Reading several papers and documents on internet, I found many contradictory information about the Cassandra data model. There are many which identify it as a column oriented database, other as a row-oriented and then who define it as a hybrid way…
cesare
  • 1,125
  • 1
  • 10
  • 14
74
votes
8 answers

What are design patterns to support custom fields in an application?

We develop a commercial application. Our customers are asking for custom fields support. For instance, they want to add a field to the Customer form. What are the known design patterns to store the field values and the meta-data about the fields? I…
Sylvain
  • 19,099
  • 23
  • 96
  • 145
69
votes
7 answers

Cloud Firestore deep get with subcollection

Let's say we have a root collection named 'todos'. Every document in this collection has: title: String subcollection named todo_items Every document in the subcollection todo_items has title: String completed: Boolean I know that querying in…
66
votes
9 answers

Should OLAP databases be denormalized for read performance?

I always thought that databases should be denormalized for read performance, as it is done for OLAP database design, and not exaggerated much further 3NF for OLTP design. PerformanceDBA in various posts, for ex., in Performance of different…
1
2 3
99 100