Tim
Tim

Reputation: 1239

Database Design Microsoft SQL Server

Was thinking of creating a small application in c# but would like to hear some feedback on approaching my project with this method.

Basically I will have 2 tables in MSSQL

    These are just examples....

 **TableType
      TableTypeID     
      Type


    TableInfo
      InfoID
      TableTypeID
      Name
      Color
      Size
      TagNumber**

So when a user wants to create a new table say birds the value would go into the tabletype create an autoid and then have the Type as birds. The name for the bird, Color, size would go into the TableInfo Table.

But now lets say that they would like to create a new table called auto. So again auto would go into tabletype under the type column and then the auto's color, size, tagnumber would all go into the next table.

Is this the right way to approach this or will this cause a lot of issues with programming in the future

Thanks

Upvotes: 1

Views: 121

Answers (2)

Neil McGuigan
Neil McGuigan

Reputation: 48236

This is a weird misuse of Table Inheritance, and it's not a good idea.

If you want to store info about birds in a relational database, you should have a table called Bird(s) that stores info only about birds. And have a different one for Autos.

You could consider using table inheritance for related types, such as Tits and Swallows

Upvotes: 2

ibondre
ibondre

Reputation: 63

Yes, this could be one way of doing based on the information you have provided.

I am guessing you will have different table types added overtime, may be even dynamically, and your code will map to a different object type on the business logic side based on those table types.

your names are confusing though, instead of using TableType, perhaps a better name could be RecordType and RecordDetails or RecordInfo.

Upvotes: 0

Related Questions