Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

foreign keys in mySql 1

Status
Not open for further replies.

Cristii00

Programmer
Nov 18, 2002
8
0
0
RO
Do i need to declare foreign keys in MySql to use them with PHP to bind two or three tables together?
actually what is the exact use of foreign keys?
 
No, you don't. In fact, unless you are using InnoDB-type tables in MySQL version 3.23.44 and higher, they aren't supported.

Foreign keys, on database servers which support them, have nothing whatsoever to do with relating tables. What they do is constrain input with the intent of increasing data consistency.

Assume, for example, that column "foo" in table "a" has a foreign key constraint which points to column "bar" in table "b". What the constraint does it insure that the only value that can be inserted in "foo" is a value that already exists in "bar".

Take a look here for more information: ______________________________________________________________________
TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top