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

  • SEARCH
  • Home
  • 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 8143055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:59:36+00:00 2026-06-06T12:59:36+00:00

Should I merge those tables into one table? Is there any tricky alternative? Table

  • 0

Should I merge those tables into one table? Is there any tricky alternative?

Table Unit for a Template table:


Id (PK)
ParentId
Name
TemplateId (FK)

Table Unit2 for a Testplan table:

Id (PK)
ParentId
Name
TestplanId (FK)

Edit:

Why not make a table like that:

[UnitId] [int] IDENTITY(1,1) NOT NULL,
    [Name] [nvarchar](50) NOT NULL,
    [TemplateId] [int] NULL,
    [TestplanId] [int] NULL,
    [ParentId] [int] NULL,

Update2:

1 Template has N Unit
1 Template has N Testplan
1 Testplan has N Unit

These are the relations using one Unit table. But this could only work with a TemplateId AND TestplanId in the Unit table.

  • 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. Editorial Team
    Editorial Team
    2026-06-06T12:59:38+00:00Added an answer on June 6, 2026 at 12:59 pm

    Following from comments in question:

    Trying to reduce the number of tables is going to obfuscate their intended purposes. When you are trying to design a relational database of object, ask yourself two questions about each relationship. Is A a B? Does A have a B?

    http://en.wikipedia.org/wiki/Is-a

    http://en.wikipedia.org/wiki/Has-a

    You’ve got a series of has-a relationships. (Specifically, has-many) Template has units. Template has testplans. Testplan has units (but, as you’ll see, different units)

    For each has-many relationships, you’ll add a foreign key column to the property table, e.g., the unit would have a template_id.

    Template
    ----------
    id
    <other columns>
    
    TemplateUnit
    ----------
    id
    template_id (FK)
    parent_id (FK) -- references same table?
    name
    <other columns>
    
    Testplan 
    ----------
    id
    template_id (FK)
    <other columns>
    
    TestplanUnit
    ---------
    id
    testplan_id (FK)
    parent_id (FK)
    name
    <other columns>
    

    With a schema like this, there’s no confusion as to what tables and what columns relate to what other objects. This makes querying very easy as well.

    SELECT *
    FROM Template a
    JOIN TemplateUnit b
        ON a.id = b.template_id
    JOIN Testplan c
        ON a.id = c.template_id
    JOIN TestplanUnit d
        ON c.id = d.testplan_id
    

    Now you know that all b columns are template units and all d columns are testplan units. Easy peasy.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to merge data from one MySQL database into another. The problem is,
If you are merging changes from repository B into repository A should you merge
I am trying to create an ANI lookup table from 2 separate tables, one
I have a table with three fields, one an identity field, and I need
I have the following 2 entities: @Entity(name = Employee) @Table(name = EMPLOYEE) public class
I have one table [Users] and another table [Administrators] linked 1:0..1 . Is it
I have one table spread across two servers running MySql 4. I need to
This is the task at hand: I have a db table named 'reports', one
I have one database table dealing with users login totals and another table dealing
I have two tables for a facebook and twitter stream. Those tables have to

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.