All Questions
Tagged with database-design inheritance
26 questions
0
votes
1
answer
809
views
Correct entity relationship diagram representation of a normalized table with a NOT NULL foreign key
Intro
Hi everyone, this is mainly a classification/theoretical question on the topic of inheritance and normalization techniques in database design and their appropriate representation in entity ...
0
votes
1
answer
112
views
table inheritance: TPH, TPT and single table vs taxonomies
according to this post and many others web resources, you can do table inheritance with Table Per Hierarchy Inheritance, Table Per Type Inheritance or Single table (single table for all sub classes).
...
2
votes
1
answer
78
views
Preserving foreign key properties when using Class Table Inheritance (or alternatives)
Imagine I have a table events, which outdoor_events and indoor_events inherit from. I have activities then outdoor_activities and indoor_activities. Assume it makes sense for outdoor and indoor to be ...
0
votes
0
answers
891
views
How to implement concrete table inheritance pattern in MySQL?
I want to know how to implement classes in MySQL that represent a subset of another class type, with the purpose of having subclasses inherit fields from the parent class. Described by Martin Fowler ...
2
votes
0
answers
785
views
Is it correct to model a specialized table using a foreign key whose referencing attributes are not also forming its primary key?
In the process of designing a database model, I would like to implement a Class Table Inheritance pattern in a way that does not seem common at first. I would like to know if it is a correct ...
2
votes
0
answers
294
views
PostgreSQL database re-design considerations
We have a 2TB PostgreSQL database, which contains two groups of tables that account for about 90% of the storage used. These two groups can be loosely described as 2 big tables partitioned, the first ...
2
votes
1
answer
222
views
Designing an extensible authentication system
I need to design an authentication system, where different type of authentication schemes may exist. At the end, I should assign a passphrase (access token) to the user.
I have several authentication ...
5
votes
3
answers
9k
views
Using table inheritance instead of mapping tables
This seems like a pretty common scenario: several types that all compose the same child type.
This could typically look like so:
-- 'name' is unique per parent record
CREATE TABLE sometype (
...
4
votes
2
answers
4k
views
Abstract classes in SQL Server. Are they even possible?
I have a very specific question that I am surprised no one has yet asked. It involves a concrete class model and SQL Server 2016 DDL. The main point is:
In my model, some classes inherit from a base ...
1
vote
1
answer
706
views
Django Multi Table Inheritance and Preserving Child and Child History
Place can have many different one to one fields, that’s why it can have bookstore, restaurant, and hardware store. But can the same place be both a bookstore and a restaurant at the same time? Now if ...
2
votes
2
answers
546
views
DB model strategy to override field value
We have to store some dynamic configuration in JSON format in DB. There would be some default configuration, and it can be overriden per account. Can someone help me with the strategy to store such ...
5
votes
2
answers
1k
views
Postgresql inheritance based database design
I'm developing a simple babysitter application that has 2 types of users: a 'Parent' and the 'Babysitter'. I'm using postgresql as my database but I'm having trouble working out my database design.
...
0
votes
2
answers
1k
views
Modeling a product database and dealing with inheritance
So, to get better at designing databases, I'm attempting to model a database system after the AR15 Builder.
Here is what I have so far:
While it makes sense logically, I'm afraid there may be ...
2
votes
3
answers
593
views
Record inheritance in mySQL
I have been struggling with this for a little while.
I want to have a set of calendar records. The top level will apply to a large group; the next level will apply to a sub-set and the final level ...
2
votes
1
answer
101
views
Finding a good DB design for my project
I've posted this on stackOverflow but this might be a more suitable place.
I'm really struggling to find a good DB design for my project using SQL server.
I've already implemented a few models which ...
7
votes
1
answer
941
views
PostgreSQL and table inheritance
I'm not sure if this is the right place for this, so please feel free to tell me if it is off-topic or there is a better place to post.
I am working on a fantasy sports based project, and the number ...
11
votes
2
answers
3k
views
Conceptual ERD Multi-table many to many, or possibly recursive?
I'm creating a conceptual diagram [yes, I know I've included attributes and keys - but this is just for me to consolidate what I'm doing whilst learning] -- so please treat it as Conceptual with the ...
4
votes
1
answer
2k
views
Enhanced ER Model Supertype / Subtype modeling issue with inheritance and recursion
Before posting, I have looked for a good solution on internet and I have coined this post for 3 days in row and trying to think through it prior this post. So if I have missed something or got it ...
4
votes
2
answers
1k
views
How to enforce data consistency across one-to-one relationship in an inheritance hierarchy
Consider this design for a typical school database:
Person:
-----------------
FirstName
LastName
SocialSecurityNumber
Phone
Email
Student:
-----------------
Grade
Teacher:
-----------------
...
0
votes
2
answers
131
views
Inheritance of unknown type at creation time
Say I have a table called People into which people are inserted from the moment they are born. Now lets say I want some subclasses of people based on their job. So there are also tables for Plumber, ...
7
votes
2
answers
12k
views
Query parent table and get child tables columns
I have two tables, one inherits the other:
CREATE TABLE parent (
col1 INTEGER
);
CREATE TABLE child (
col2 INTEGER
) INHERITS( parent );
// Insert some data
INSERT INTO parent( col1 ) ...
1
vote
1
answer
539
views
Will switching from Concrete Table Inheritance to Single Table Inheritance improve the performance of my queries?
I currently have an application that allows people to view and share 10 different types of posts (ex SportsPost, WorldNewsPost, TechnologyPost, etc). All posts types are conceptually the same, but ...
0
votes
1
answer
654
views
Foreign key double inheritance SQLITE
I'm designing a domotic system database and I'm trying to figure out how to represent two foreign keys.
This is the cardinality I want. Consider 1...N Areas (rooms, halls, kitchens, etc.):
Area 1 - ...
2
votes
1
answer
543
views
Is this a step in the right direction for normalization? SQL 'inheritance' and Many-to-Many relationships
Context:
So, this is kind of a compound question, but they go together, and definitely wouldn't make sense split up into separate questions.
I've been working on a new database for what will end up ...
0
votes
1
answer
96
views
Table join inheritance
I create db with Person, Client, Employee, Manager, Developer. I'm interested what is the best way to put the data in tables. In which cases should programmer unite Client in table hierarchy with ...
7
votes
2
answers
5k
views
Polymorphic Association - is it bad?
In the following schema:
Collections
Upvotes
Reports
Upvotes
Reviews
Upvotes
I'm tempted to have a single Upvotes table with a single "entityId" column that stores either the CollectionId, ...