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

Compare with Current View Page History

Version 1 Next »

두 테이블이 복합키로 지정이 되어 있으나, 테이블은 외래키가 없어 물리적 연관이 없을때

JOIN전략을 통해 논리적인 연관을 Entity간 맺는 방법을 알아보겠습니다.


샘플 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