Talk:Foreign key

From Wikipedia, the free encyclopedia

This article is within the scope of WikiProject Databases.
??? This article has not yet received a rating on the assessment scale.
Low rated as low-importance on the assessment scale

[edit] Remark

what is key and y we are using primary key and foriegn key in normalization of database.

how do you actually perform a Forgein Key!? i know how primary key looks like, what does a Foreign Key look like? >x<ino 10:58, 2 December 2005 (UTC)

Oy! It took me forever to get to anything that actually explained it. So I added a sentence in the middle to explain it. MikeyTheK 22:22, 10 February 2007 (UTC)

I rewrote most of the article because (so far) the article only gave some examples instead of explaining the concepts of FKs. --Stolze 12:48, 14 February 2007 (UTC)

i want definitions sort and clear,not lengthy as to suit students —Preceding unsigned comment added by 117.97.4.228 (talk) 02:47, 11 September 2007 (UTC)

[edit] FK

The repeated use of the unnecessary abbreviation FK was non-encyclopaedic. Removed.—Preceding unsigned comment added by 86.138.228.61 (talk • contribs)

As far as i can tell , in the section titled "Defining Foreign Keys", the syntax offered for column level referencial constraint in CREATE TABLE:

col3 INTEGER FOREIGN KEY REFERENCES other_table(column_name)

is not correct, according to sql:2003. Instead, it should be:

col3 INTEGER REFERENCES other_table(column_name)

In other words, the FOREIGN KEY keywords should not be there. In fact, the postgresql version shown in the next example is correct according to syntax. Gnarinn (talk) 17:03, 27 March 2008 (UTC)

[edit] Vendor support

Worth mentioning that some major DBMS vendors (MySQL[1]) recognize the statement syntax but don't actually support foreign keys, which means that this functionality will fail silently. Very bad. Ham Pastrami (talk) 06:12, 22 April 2008 (UTC) Clarify: In MySQL you can get foreign keys with the InnoDB engine, but not with other table types. Ham Pastrami (talk) 06:23, 22 April 2008 (UTC)