Skip to content
Advertisement

Tag: database-design

SQL one to one relationship vs. single table

Consider a data structure such as the below where the user has a small number of fixed settings. User UserSettings Is it considered correct to move the user’s settings into a separate table, thereby creating a one-to-one relationship with the users table? Does this offer any real advantage over storing it in the same row as the user (the obvious

SQL: Advantages of an ENUM vs. a one-to-many relationship?

I very rarely see ENUM datatypes used in the wild; a developer almost always just uses a secondary table that looks like this: But the same thing can also be shown using a user-defined type / ENUM: (Example shown using PostgreSQL, but other RDBMS’s have similar syntax) The biggest disadvantage I see to using an ENUM is that it’s more

Advertisement