You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

연관있는 두 테이블이 복합키로 지정이 되어있으나, 외래키설정이 되어있지 않을때

설계상의 문제이거나, 관계도가 있는 왼쪽에비해 오른쪽에대해 무결성을 지킬필요가 없을때

존재할수 있으며 이러한 테이블의 종류가 운영이지속될수록 많이 생긴다는것입니다.


관련 영문 키워드:

mapping compositekey primary and non forign


샘플 DDL

ItemlInfo

CREATE TABLE `db_example2`.`iteminfo` (
  `itemtype` CHAR(1) NOT NULL,
  `itemno` INT NOT NULL,
  `itemname` VARCHAR(45) NULL,
  PRIMARY KEY (`itemtype`, `itemno`));


ItemStatics

CREATE TABLE `db_example2`.`itemstatics` (
  `itemtype` CHAR(1) NOT NULL,
  `itemno` INT NOT NULL,
  `viewcnt` INT NULL,
  `salecnt` INT NULL,
  PRIMARY KEY (`itemtype`, `itemno`));





  • No labels