Discussion Locked

Database Design

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

This question is related to subtype of Entities...

I have One Table has two fields - Field1 & Filed2...

Now Data will be entered in this table which will be like this...

Field1 Field2
Data_key1 Data1
Data_key2 Data2
Data_key3 Data3
Data_key4 Data4
Data_key5 Data5

Now User will select one of them, n I have to maintain detailed record of each Data which will have different fields of different data types...

e.g.

Data1_Table
Field11 Char
Field12 Number
Field13 Date
Field14 Currency

Data2_Table
Field21 Boolean
Field22 Char
Field23 Date
Field24 char
Field25 Currency
Field26 Byte
Field27 Number
Filed28 Number

etc...

So I have to maintain record of data fields which will be a data of Master table....

So how should i design tables n maintain a relationship between this...? n i have to consider a normalisation also which should not create a updation/insertion or deletion anamalies while manipulating with a data in future...

If anyone have solution abt this, plz reply me soon on yogesh@sadhanwebworks.com

Thanks in Advance...

Yogee.

3 replies

by donq

Yogee,

You really need to understand a few "basics" regarding Normalized database Table structuring.

For exampple:

Your two Tables MUST each contain different data ( or values related to a single subject). If one table contains the "Data Types" available through a specific database product name that table "Data Types" and make field 1 a "text" Primary Key (dtPK)about 20 characters long that will NOT allow duplicates. Enter you Data Types there.

Let your second table represent DataType "children"; for example a Numerical Data Type may be a "Byte", "Integer", Long Integer", "Single", "Double", etc. Each of these represent a Data Type "child" or sub-type and should be stored in a Table named DataTypeSubs (for Data Type Sub-types) Make this tables field 1 a Primary Key as well named "dtsPK" (for Data Type Sub Primary Key). Set it to text (24) or whatever is required like you did the first table.

Now add a field to Table 1 named "dtFKdts" (for Data Type FOREIGN KEY to Data Type Sub) and construct a look-up field that inserts a value from the DataTypeSub Table. This establishes a one-to-many relationship between the two tables and allows each Data Type to have many children; but each sub type may only have one "parent" or Data Type.

Good Luck.

This discussion is closed to new replies.