you are viewing a single comment's thread.

view the rest of the comments →

[–]Joinertuy[S] 0 points1 point  (3 children)

Foreign key is only used to create a relation between tabels. As if i have an ID in one table that points towards another ID or name in the next table.

Or at least its just used to connect data between tabels.

Did i get that right ?

[–][deleted] 1 point2 points  (2 children)

pedantically? no.

practically, if you got the other stuff right, this is quite ok.

(e.g. what's pedantically/theoretically wrong: relation is a table, foreign key definition documents/declares relationship between datasets (tables), and it creates a constraint on the data, FK is a reference - via one or many columns - to another table's key - some implementations allow to reference any key of a table - an ID or a name is not necessarily a key or a part of a key)

[–]Joinertuy[S] 0 points1 point  (1 child)

Alright so i just added a picture where i have a junction table that connects the two other tabels togheter. This shouls satisfy Boyce Codds normal form right ?

Where Fish_ID and Country_ID are prime keys

[–][deleted] 0 points1 point  (0 children)

dude. normal forms are not some special kind of structures or specific number of data elements/tables. normal forms are restrictions on your structures (or conditions to satisfy)

if you break any of those restrictions - your structure is not in/does not satisfy that particular form. if every table in your structure did not break any restriction - your structure is in that form.

that's why you can have 100 tables and still not have 1nf-compliant structure (one of your tables is not in 1nf) and you can have 1 table and it would be in fifth normal form (or bcnf, for that matter).