ã¨ã³ãã£ãã£ã®ä¾åé¢ä¿ã«ã¤ãã¦
ã©ãããå ´åã«ä¾åã¨ã³ãã£ãã£ã«ããã¹ãããéã«ã©ãããå ´åã¯ç¬ç«ã¨ã³ãã£ãã£ããåãããªãã£ãã®ã§ã追å ã§èª¿ã¹ã¦ã¿ã¾ããã
å¤é¨ãã¼ã主ãã¼ã«ãªã£ã¦ãããªããããã¯ä¾åã¨ã³ãã£ãã£ã¨ããã®ã¯åãããã§ãããçç±ãç¥ããã«çµæã ãè¦ãã¦ãå¿ç¨ãå©ããªãã®ã§ã
ã注æãã¨ã³ãã£ãã£ã¨ãåºè·ãã¨ã³ãã£ãã£ã¯ä¾åã®ãªã¬ã¼ã·ã§ã³ã·ããã«ããã¾ãããä¾åã®ãªã¬ã¼ã·ã§ã³ã·ãããã¨ã¯ãã¤ã¾ãã親ã¨ã³ãã£ãã£ã«ä¾åããªããã°åã¨ã³ãã£ãã£ãåå¨ã§ããªãç¶æ ããæå³ãã¾ãããããè¸ã¾ããã¨ãå³2ã®ä¾åã®ãªã¬ã¼ã·ã§ã³ã·ããã¯åºè·ãè¡ãã«ã¯å¿ ã注æãå¿ è¦ã«ãªãã¨ãããã¸ãã¹ã«ã¼ã«ã表ãã¦ãã¾ãããªããä¾åã®ãªã¬ã¼ã·ã§ã³ã·ããã表ç¾ããå ´åã¯å®ç·ã使ãã¾ãã
ãä¾ãã°ã顧客ã®è¦æã«ããå è¡åºè·ãè¡ããã¨ãããå ´åãã注æãã¨ã³ãã£ãã£ã¨ãåºè·ãã¨ã³ãã£ãã£ã¯å³3ã®ERå³ã®ããã«ãç¬ç«ã®ãªã¬ã¼ã·ã§ã³ã·ãããã¨ãã¦è¡¨ç¾ãã¾ããä¾åã®ãªã¬ã¼ã·ã§ã³ã·ããã¯å®ç·ã§è¡¨ãã¾ããããç¬ç«ã®ãªã¬ã¼ã·ã§ã³ã·ããã¯ç ´ç·ã§è¡¨ãã¾ãã
ビジネス視点のデータモデリング (1/3):ゼロからのデータモデリング入門(8) - @IT
ã¡ãã£ã¨å¿è¨±ãªãã§ãããçç±ã説æãã¦ããã®ã¯ãããããã§ããã
ãã£ã¨ãã¼ã¿ã¢ããªã³ã°ã®éã®èãæ¹çãªãã®ããããã¨æã£ããã§ããã[ãã¼ã¿ã¢ããªã³ã° ä¾åé¢ä¿] ã¨ãã§æ¤ç´¢ãã¦ãåºã¦ããªãã£ãã®ã§ããããªæ·±ããã®ã§ããªãã®ããã
注æ/åºè·ã¨ã³ãã£ãã£ãERå³*1ã«æ¸ãã¦ã¿ã¾ããã
åºè·ãä¾åãã¦ãã®ã¨ç¬ç«ãªã®ã§2ãã¿ã¼ã³ã
æ®éã«èããã°æ³¨æãåãã¦ããåºè·ããããã注æã¨ã³ãã£ãã£ã«åºè·ã¨ã³ãã£ãã£ãä¾åãã¾ãã
注æãã¾ã ãªãã®ã«ãå
ã«åºè·ããããããªå ´åãèããã¨ãåºè·ã¨ã³ãã£ãã£ãç¬ç«ãããªãã¨ã ãã
åºè·ã¨ã³ãã£ãã£ã«å¤é¨ãã¼ã¨ãã¦ãã注æIdãã注æã¨ã³ãã£ãã£ã«ã¾ã ãªãã¦ãè¯ãã¨ããäºã§ãã
å¤é¨ãã¼
å¤é¨ãã¼ã¯å¿
ã NOT NULL å¶ç´ãä»ãã¨åéããã¦ãã¾ããã
å¤é¨ãã¼ä½¿ãã¨ãã¯ããã¤ã NOT NULL ã«ãã¦ãããå®éã«å¤é¨ãã¼ãNULLã ã¨ã ããªãã®ãä½ã£ã¦ããã
ã§ãå®ã¯å¤é¨ãã¼å¶ç´ã¨ããã®ã¯ãNULLã許容ãã¾ããã
ä»ã®RDBMSã¯åããã¾ããããå°ãªãã¨ãPostgresã§ã¯ã
å¤é¨ãã¼ã«NULLãå
¥ããããã°ãid_order ã NULL ã«ãã¦ã注æããå
ã«åºè·ãåºæ¥ããã§ãã
ãã1åçåç¹ãã»ã»ã»
ã£ã¨ãããã¾ã§æ¸ãã¦æ°ãã«çåç¹ãåºã¦ãã¾ããã
ä¾åã¨ã³ãã£ãã£ã®å ´åã親åéã®ã«ã¼ãã£ããªãã£ã¯one-to-oneã®é¢ä¿ããããããªãï¼
ä¾åã¨ã³ãã£ãã£ã¯ã親ã®ä¸»ãã¼ãå¤é¨ãã¼ã¨ãã¦æã¡ããããèªèº«ã®ä¸»ãã¼ã«ãã¾ãã
å®éã«ãERå³ãæ¸ããã¼ã«ã§ããåºè·ãä¾åã¨ã³ãã£ãã£ã«è¨å®ãããã¨ããã¨ãå¼·å¶çã« id_order ã¯ä¸»ãã¼ã«ããããå¾ã¾ããã
ã§ããä¾ãã°Postgresã®ä¸»ãã¼ã¨ããã®ã¯ã¦ãã¼ã¯å¶ç´ã¨NOT NULLå¶ç´ãåããããã®ã§ãã
id_order ã«ã¦ãã¼ã¯å¶ç´ãããã¨ããäºã¯ã注æã¨åºè·ã¯one-to-oneã«ãããªããªãæ°ããã¾ãã
ãã¼ããæ¯ãåºãã«æ»ã£ãæãã»ã»ã»ãã£ã¨èª¿ã¹ãªãã¨ã
*1:IDEF1X