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
16
votes
3 answers

Mysql Datatype for US Zip (Postal Codes)

I am writing a web application, that is US specific, so the format that other countries use for postal codes are not important. I have a list of us zip codes that i am trying to load into a database table that includes the 5 digit us zip…
gsueagle2008
  • 4,583
  • 10
  • 36
  • 46
15
votes
3 answers

Firestore: Version history of documents

I'm looking for a proper way to structure Firestore database to handle multiple version histories of documents inside a single collection. For example: I have a collection named offers which have multiple documents which correspond to multiple…
Sebastijan Dumančić
  • 1,165
  • 1
  • 11
  • 20
15
votes
5 answers

SQL - Best practice for a Friendship table

Before you show me duplicates, please note that I've searched through the site an have found some examples but not quite specific to my problem :) What's the best way to create a Friendship table in SQL, but making sure that each row is unique in…
Marko
  • 71,361
  • 28
  • 124
  • 158
15
votes
5 answers

How to keep ordering of records in a database table

i am creating a database table that is going to store menu links that will ultimately show up on a web page. My issue is that i want to control the order of the menu items. I could have a field called order but everytime i have a new menu link i…
leora
  • 188,729
  • 360
  • 878
  • 1,366
15
votes
10 answers

Relational database design question - Surrogate-key or Natural-key?

Which one is the best practice and Why? a) Type Table, Surrogate/Artificial Key Foreign key is from user.type to type.id: b) Type Table, Natural Key Foreign key is from user.type to type.typeName:
aryaxt
  • 76,198
  • 92
  • 293
  • 442
15
votes
3 answers

Using categorical data as features in sklean LogisticRegression

I'm trying to understand how to use categorical data as features in sklearn.linear_model's LogisticRegression. I understand of course I need to encode it. What I don't understand is how to pass the encoded feature to the Logistic regression so it's…
15
votes
2 answers

Can a model have both high bias and high variance? Overfitting and Underfitting?

As I understand it when creating a supervised learning model, our model may have high bias if we are making very simple assumptions (for example if our function is linear) which cause the algorithm to miss relationships between our features and…
Alaa Awad
  • 3,612
  • 6
  • 25
  • 35
15
votes
9 answers

Database design for write-heavy web application

A lot of the LOB applications we provide to our customers are of a marketing / promotional nature (sweepstakes, event registration, etc...). Most of the applications, while very simple, are very demanding on the database. Imagine a "registration"…
Chris
  • 27,596
  • 25
  • 124
  • 225
15
votes
20 answers

What is the ultimate program to make a drawing of a database model?

One of the first things I do when I'm on a new project is design a database model. To visualize the model I use a 7 year old version of Smartdraw. Maybe it's time for something new. What is the ultimate program to make a drawing of a database model.…
boes
  • 2,835
  • 2
  • 23
  • 28
14
votes
1 answer

Using crow's feet notation in data modelling in enterprise architect

I am only able to use connectors in enterprise architect with traditional 0..* style multiplicity rather than crow's feet connectors. I've tried using different drawing styles and still cannot work out how to change the connectors. Any help would be…
jess
  • 254
  • 3
  • 13
14
votes
1 answer

Is it best to have many field in protobuf message or nested messages?

I tried to find some recommendations on the web but could not find anything relevant. Let's say that I am creating a protocol buffer message that will contain a lot of fields (50+). Is it best to keep all the fields at the same level or to organize…
14
votes
7 answers

Positive or negative boolean field names?

A table's boolean fields can be named positively or negatively. For example, calling a field: "ACTIVE" , 1=on / 0=off or "INACTIVE" , 0=on / 1=off Is there a proper way to make this type of table design decision or is it arbitrary? My specific…
cardflopper
  • 976
  • 2
  • 12
  • 19
13
votes
2 answers

Managing hierarchies in SQL: MPTT/nested sets vs adjacency lists vs storing paths

For a while now I've been wrestling with how best to handle hierarchies in SQL. Frustrated by the limitations of adjacency lists and the complexity of MPTT/nested sets, I began thinking about simply storing key paths instead, as a simple…
Yarin
  • 173,523
  • 149
  • 402
  • 512
13
votes
3 answers

Best practices to enable/disable/delete database rows and its references?

What are the best practices for handling deletion or enabling/deletion of rows and its referenced tables? For instance, assume I have a very simple kind of 'forum' app. I have a table users that contains my webapp accounts and threads that contains…
smellyarmpits
  • 1,080
  • 3
  • 13
  • 32
13
votes
2 answers

Star schema, normalized dimensions, denormalized hierarchy level keys

Given the following star schema tables. fact, two dimensions, two measures. # geog_abb time_date amount value #1: AL 2013-03-26 55.57 9113.3898 #2: CO 2011-06-28 19.25 9846.6468 #3: MI 2012-05-15 94.87 4762.5398 #4: …