Mindblock: SQL and normalisation

Soldato
Joined
16 Nov 2003
Posts
9,682
Location
On the pale blue dot
I must not be getting something. Can you at least 2NF data in SQL?

For example if I have a table with elements A, B and C, a column in another table should only let you select one of these elements. Is it a case of just enforcing this through the input method (i.e. in the webform have a drop down box populated by the first table rather than a input field) or is there a way to link elements within SQL.

I am using MySQL at the moment.
 
Associate
Joined
5 Jun 2005
Posts
987
Location
Leicestershire
SiD the Turtle said:
I must not be getting something. Can you at least 2NF data in SQL?

For example if I have a table with elements A, B and C, a column in another table should only let you select one of these elements. Is it a case of just enforcing this through the input method (i.e. in the webform have a drop down box populated by the first table rather than a input field) or is there a way to link elements within SQL.

I am using MySQL at the moment.

Data in tables can be said to either be or not be in 2nd normal form depending on how the fields in the tables are related to their corresponding primary keys and each other. Seperately/Apart from this, is the issue of referential integrity, which can be implemented via SQL if the underlying database engine supports it (i.e. you need to set up a foreign key contraint on the field in the "other" table so it references the table where A, B and C are primary key values. )
 
Soldato
OP
Joined
16 Nov 2003
Posts
9,682
Location
On the pale blue dot
ByteJuggler said:
Data in tables can be said to either be or not be in 2nd normal form depending on how the fields in the tables are related to their corresponding primary keys and each other. Seperately/Apart from this, is the issue of referential integrity, which can be implemented via SQL if the underlying database engine supports it (i.e. you need to set up a foreign key contraint on the field in the "other" table so it references the table where A, B and C are primary key values. )

Ah ha! Foriegn keys! That's what I was trying to think of. Thanks for that.
 
Back
Top Bottom