Jump to content

Foreign keys....


mannyee

Recommended Posts

hi guys!!

 

while going thru a tutorial on php-mysql, i came across the following query:

 

CREATE TABLE IF NOT EXISTS `tbl_category` (

  `cat_id` int(10) unsigned NOT NULL AUTO_INCREMENT,

  `cat_parent_id` int(11) NOT NULL DEFAULT '0',

  `cat_name` varchar(50) NOT NULL DEFAULT '',

  `cat_description` varchar(200) NOT NULL DEFAULT '',

  `cat_image` varchar(255) NOT NULL DEFAULT '',

  PRIMARY KEY (`cat_id`),

  KEY `cat_parent_id` (`cat_parent_id`),

  KEY `cat_name` (`cat_name`)

) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=18 ;

 

 

 

Here, i am a bit confused about the term KEY..... what's it purpose? Is the author trying to create a foreign key?? If yes, then the table should have been INNODB......isn'it?

Link to comment
https://forums.phpfreaks.com/topic/195830-foreign-keys/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.