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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.