Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 52003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T16:50:20+00:00 2026-05-10T16:50:20+00:00

What are the best practices for modeling inheritance in databases? What are the trade-offs

  • 0

What are the best practices for modeling inheritance in databases?

What are the trade-offs (e.g. queriability)?

(I’m most interested in SQL Server and .NET, but I also want to understand how other platforms address this issue.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T16:50:20+00:00Added an answer on May 10, 2026 at 4:50 pm

    There are several ways to model inheritance in a database. Which you choose depends on your needs. Here are a few options:

    Table-Per-Type (TPT)

    Each class has its own table. The base class has all the base class elements in it, and each class which derives from it has its own table, with a primary key which is also a foreign key to the base class table; the derived table’s class contains only the different elements.

    So for example:

    class Person {     public int ID;     public string FirstName;     public string LastName; }  class Employee : Person {     public DateTime StartDate; } 

    Would result in tables like:

    table Person ------------ int id (PK) string firstname string lastname  table Employee -------------- int id (PK, FK) datetime startdate 

    Table-Per-Hierarchy (TPH)

    There is a single table which represents all the inheritance hierarchy, which means several of the columns will probably be sparse. A discriminator column is added which tells the system what type of row this is.

    Given the classes above, you end up with this table:

    table Person ------------ int id (PK) int rowtype (0 = 'Person', 1 = 'Employee') string firstname string lastname datetime startdate 

    For any rows which are rowtype 0 (Person), the startdate will always be null.

    Table-Per-Concrete (TPC)

    Each class has its own fully formed table with no references off to any other tables.

    Given the classes above, you end up with these tables:

    table Person ------------ int id (PK) string firstname string lastname  table Employee -------------- int id (PK) string firstname string lastname datetime startdate 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What are the best practices for working with Sql server Xml columns to ensure
What are best practices concerning error handling in an ASP.NET MVC2 web app that
What best practices should be observed when implementing HDL code? What are the commonalities
What are the best practices to consider when catching exceptions and re-throwing them? I
What are the best practices around creating flat file database structures in PHP? A
What are the best practices for checking in BIN directories in a collaborative development
What's are the best practices for versioning web sites? Which revision control systems are
I am looking for best practices for detecting and preventing DOS in the service
Are there any best practices (or even standards) to store addresses in a consistent
What are the best practices for using Java's @Override annotation and why? It seems

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.