I’m reading about foreign keys and constraints. Very eye-opening. If there is a book you recommend to learn more about this please let me know. I’m very tempted to buy Pro MySQL or [URL=“http://www.amazon.com/Definitive-Guide-MySQL-Third/dp/1590595351/ref=sr_1_12?ie=UTF8&s=books&qid=1258740303&sr=1-12”]The Definitive Guide to MySQL 5 to learn more. Or if there is a very good well-explained, detailed tutorial please also let me know. I’m going over one of my books: PHP and MySQL Web Development but it just tells you what they are and gives you ONE brief example. It doesn’t even go into detail at all.
Ok so, this is what I’m trying to figure out.
Let’s say I have a clients table and a clientsContact table:
CLIENTS TABLE
[LIST]
[]clientid
[]firstname
[*]lastname
[/LIST]
CLIENTSCONTACT TABLE
[LIST]
[]clientid
[]address
[]city
[]state
[*]phone
[/LIST]
The book I have and a tutorial I read tells you how to establish a constraint using foreign keys. But what I want is for example:
[LIST]
[]if I add a record to clients table, add a record to clientscontact table even if the records on clients contact will be empty.
[]and viceversa: if I delete a record from the clients table, also automatically delete the record on the clientscontact table.
[/LIST]
Thanks in advance