Dear Friends,

Could you please tell me what are the advantages of setting foreign key in
database ?


I had created two tables

users
   id
   name
details
   id
   address
   users_id (foreign key)

Could you please tell me what are the advantages of using like this ?
and how to operate on this data ?

Can i able to insert both table data into it with one query  ?

If you have any info please share me


CREATE TABLE IF NOT EXISTS `details` (
  `id` int(11) NOT NULL auto_increment,
  `address` varchar(255) NOT NULL,
  `users_id` int(11) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `users_id` (`users_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;



CREATE TABLE IF NOT EXISTS `users` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

Thanks in advance

-- 
Arun Raj R

Developer , OrisysIndia IT Enabled Services, Thiruvananthapuram
Corporate office : Bangalore
Phone : 0471-(40)-14325
Mobile : 919946014345
Blog : www.techaspirant.com
www.OrisysIndia.com
Linkedin: www.linkedin.com/in/arunrajr

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to