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
38
votes
4 answers

Where should I store a foreign key?

If I have a relationship between two tables (both tables have their own primary keys) what should guide my decision as to which table should store the foreign key? I understand that the nature of the relationship probably matters (one-to-one,…
vicatcu
  • 5,407
  • 7
  • 41
  • 65
37
votes
6 answers

What are the principles behind, and benefits of, the "party model"?

The "party model" is a "pattern" for relational database design. At least part of it involves finding commonality between many entities, such as Customer, Employee, Partner, etc., and factoring that into some more "abstract" database tables. I'd…
Charlie Flowers
  • 17,338
  • 10
  • 71
  • 88
37
votes
6 answers

A good database modeling tool for PostgreSQL?

PostgreSQL comes with the excellent pgAdmin-tool for managing the database but lacks GUI data-modeling utility? I found this list: http://www.databaseanswers.org/modelling_tools.htm but don't have time to evaluate them. Which one do YOU recommend?
huug
  • 1,059
  • 2
  • 11
  • 25
34
votes
3 answers

Data modeling practices in Redis?

I've recently been getting into Redis and find it very appealing. I'd like to see how far I can push it's limits as a database. I read the Retwis tutorial and found it very interesting. I'm wondering if there are even more resources that give…
daveslab
  • 10,000
  • 21
  • 60
  • 86
34
votes
8 answers

How can I avoid NULLs in my database, while also representing missing data?

In SQL and Relational Theory (C.J. Date, 2009) chapter 4 advocates avoiding duplicate rows, and also to avoid NULL attributes in the data we store. While I have no troubles avoiding duplicate rows, I am struggling to see how I can model data without…
ocharles
  • 6,172
  • 2
  • 35
  • 46
33
votes
1 answer

Is there a difference between Surrogate key, Synthetic Key, and Artificial Key?

Are there any differences among a Surrogate Key, Synthetic Key, and an Artificial Key? I'm not clear on the exact difference.
Harshad
  • 713
  • 1
  • 7
  • 8
32
votes
4 answers

ExtJS 4: Models with Associations and Stores

Introduction I'm facing an application design problem with the Ext.data.Model class in ExtJS. I will try to develop my ideas to a very common online store scenario here, so you can follow me. I would really appreciate any comments on my thoughts and…
Konrad Kleine
  • 4,275
  • 3
  • 27
  • 35
30
votes
1 answer

Working with nested single queries in Firestore

Recently I moved my data model from Firebase to Firestore. All my code is working, but I'm having some ugly troubles regarding my nested queries for retrieve some data. Here is the point: Right now my data model for this part looks like this(Yes!…
29
votes
5 answers

single fixed table with multiple columns vs flexible abstract tables

I was wondering if you have a website with a dozen different types of listings (Shops, Restaurants, Clubs, Hotels, Events) that require different fields, is there a benefit of creating a table with columns defined like so Example Shop: shop_id |…
Moak
  • 12,596
  • 27
  • 111
  • 166
28
votes
6 answers

Avoid exposing primary keys in the source of a web app?

I often come across web applications that expose internal database primary keys through forms like select boxes. And occasionally I see javascript matching against an int or guid magic value that switches the logic. Is is a best practice to avoid…
Ryu
  • 8,641
  • 10
  • 65
  • 98
28
votes
5 answers

Good place to look for example Database Designs - Best practices

I have been given the task to design a database to store a lot of information for our company. Because the task is rather big and contains multiple modules where users should be able to do stuff, I'm worried about designing a good data model for…
Younes
  • 4,825
  • 4
  • 39
  • 66
28
votes
3 answers

How to *really* write UML cardinalities?

I would like to know once and for all how to write UML cardinalities, since I very often had to debate about them (so proofs and sources are very welcome :) If I want to explain that a Mother can have several Children but a Child has one and only…
sp00m
  • 47,968
  • 31
  • 142
  • 252
23
votes
5 answers

Database design for a recursive relationship

Consider this case where I'm trying to model a database for a company: Entities: Employees, Managers, Departments. An Employee works in only 1 Department while a Department may have many Employees working in it. A Manager may manage only 1…
Songo
  • 5,618
  • 8
  • 58
  • 96
23
votes
2 answers

How do I generate Diagrams and UML of Kotlin code?

How do I generate UML and diagrams for Kotlin code? I don't think getting the paid version of Intellij is an option for me. I have been trying Intellij plugins and I haven't found anything that works yet. I would like to generate the diagrams and…
Philip Nguyen
  • 871
  • 2
  • 10
  • 29
22
votes
12 answers

Best way to model Customer <--> Address

Every Customer has a physical address and an optional mailing address. What is your preferred way to model this? Option 1. Customer has foreign key to Address Customer (id, phys_address_id, mail_address_id) Address (id, street, city,…
Tony the Pony
  • 40,327
  • 71
  • 187
  • 281