0

Hi I have a little bit of a database design problem

The user needs to capture

Form, Length min,length max, width min,width max, gauge min,gauge max(this is simplified). he is expected to enter the form and at least one part e.g. the form and length min and max. He may enter more than one part.

I get the feeling that I should not have 1 table. I was planning on creating a form, length, width and gauge table. The length, width and gauge table will have a foreign key to the form table and my dimensions table will share the same primary key (I think this is a 1 to 1/0 relationship). This will allow me to have/ not have certain parts where needed and eliminate null entries. My first problem is, is this good database design? If I need to delete how can I delete without removing the relationship(in plsql)?

Community
  • 1
  • 1
David
  • 5,403
  • 15
  • 42
  • 72
  • 1
    I think the best advice may depend on just how simplified a representation this is. – David Aldridge Feb 16 '17 at 19:21
  • @DavidAldridge The form consists of 3 more columns to describe the metal and the dimension parts consists of1 more column for length it would be length length min and length max. – David Feb 17 '17 at 06:53

2 Answers2

0

Deleting rows with a 1 to 0/1 relationship is the same as for a 1 to many relationship. You could define the FK with on delete cascade so deleting the parent automatically deletes the child, or else always delete the child first.

I'm not sure I understand your model well enough to advise whether the two-table approach is the right one here, but in general it's a perfectly good technique when a subset of columns might not apply.

I don't see a PL/SQL question though so perhaps I'm missing something.

William Robertson
  • 15,273
  • 4
  • 38
  • 44
0

I good database design starts with Normalization. Hope the below link expains it lucidly.

Normalization

Avrajit Roy
  • 3,233
  • 1
  • 13
  • 25