logo       

Fwd: Re: Foreign key: msg#01107

db.mysql.general

Subject: Fwd: Re: Foreign key

-----------Sorry by my english, I'm brazilian------------------

I created the following tables in MySql database:

create table person(
id_person smallint not null primary key auto_increment,
name varchar(10));

create table friends(
id_friend smallint not null primary key auto_increment,
age smallint,
id_person smallint not null,
foreign key (id_person) references person (id_person));

For example:
I put a row in table PERSON with "id_person = 1"
If I try to put in table FRIENDS "id_person = 7", I get...why?

Should not give error?
And the referential integrity?

Thanks,
Elby.


_________________________________________________________________
MSN Photos é a maneira mais fácil e prática de editar e compartilhar sua fotos: http://photos.msn.com.br


---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail <mysql-thread113356@xxxxxxxxxxxxxxx>
To unsubscribe, e-mail
<mysql-unsubscribe-gcdmg-mysql=m.gmane.org@xxxxxxxxxxxxxxx>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise