Foriegn Key Questions - Joomla! Forum - community, help and support


good afternoon,
i trying create component joomla , having problem way foreign key being defined. if 1 explain me understand it. see comment in categories table stating asset_id fk asset table. understand foreign key not how sql knows fk out reference or something.

i took out tables not needed cut down on post.

code: select all

create table if not exists `#__assets` (
  `id` int(10) unsigned not null auto_increment comment 'primary key',
  `parent_id` int(11) not null default '0' comment 'nested set parent.',
  `lft` int(11) not null default '0' comment 'nested set lft.',
  `rgt` int(11) not null default '0' comment 'nested set rgt.',
  primary key (`id`),
  unique key `idx_asset_name` (`name`),
  key `idx_lft_rgt` (`lft`,`rgt`),
  key `idx_parent_id` (`parent_id`)
) default charset=utf8;


code: select all

create table `#__categories` (
  `id` int(11) not null auto_increment,
  `asset_id` integer unsigned not null default 0 comment 'fk #__assets table.',
  `parent_id` int(10) unsigned not null default '0',
  `lft` int(11) not null default '0',
  `rgt` int(11) not null default '0',
  primary key  (`id`),
  key `cat_idx` (`extension`,`published`,`access`),
  key `idx_access` (`access`),
  key `idx_checkout` (`checked_out`),
  key `idx_path` (`path`),
  key `idx_left_right` (`lft`,`rgt`),
  key `idx_alias` (`alias`),
  index `idx_language` (`language`)
)  default charset=utf8;



thanks shanon

i internet this(fk) primary key different table need reference table.





Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support