ããããã¦ãã¦ãåãå ¥ããã¹ãã§ã¯ãªã
ãSQLã使ããªãæåäºä¾ãããã¾ãããªãã¦æ¸ãã¨ãSQLãè¦æã ã¨èãã¦ãã層ã«ããããã©ããªã«ããããã¦ãã¦ã§ã諸æãæãã¦åãå ¥ããããã
ãããããããã¸ã§ã¯ãã¨ãã¦ã¯æåã§ããæè¡çã«æåã¨ãæ£ããã¨ãè¨ããªãããã¡ãããããã ãã§ã¯ééã£ã¦ããã¨ãè¨ããªãã
ãæè¡çã«ã¯ããã¸ã§ã¯ãã®æå¦ã«ããããããæè¡ãè©ä¾¡ããå¿
è¦ãããã
ä¸æµæè¡è ã®åéããåºå®åãæåãªã
ãä½åº¦ãæ¸ãããã¨ããããã ããã©ãCOBOLãã VB / Oracle ã®ä¸çã«å¤ãã®æè¡è ããã£ã¦ããé ãã³ã¼ãã£ã³ã°è¦ç´ã«ãé åã¯ä½¿ç¨ç¦æ¢ï¼ãã¨ããã®ã¯çãããªãã£ããCOBOLerã®å¤ãã¯ãé åã使ãã¨è¨³ãåãããªããªããããã2006å¹´é ã«ãæªã ã«ç¦æ¢ãã¦ããã³ã¼ãã£ã³ã°è¦ç´ãè¦ããã¨ãããã®ã§ãæ ¹å¼·ãå®ã£ã¦ããä¼ç¤¾ï¼å¤§SIeræ§ã§ããï¼ãããããã ã
ãä¸è¬çã«ã¯ããé åã¯ä½¿ç¨ç¦æ¢ï¼ããªãã¦ç¬ã話ã«ãªããããæ·æ±°ãããããä¸é¨ã§æ ¹å¼·ãæ®ã£ã¦ããã®ã¯ããªããï¼
ãæ·æ±°ãããçç±ã¯ä¸æµã«ç«ã¤æè¡è ããé åã使ããã©ãããã¾ã§è¨åããå¿ è¦ããªããããä¸æµã«ä½ç½®ããããã°ã©ãã®å¿ããä¸ã¤ã§æ·æ±°ã§ãããä¸æ¹ãæ·æ±°ã§ããªãã£ãä¼ç¤¾ã§ã¯ããã¼ã¸ã£ã¯ã©ã¹ãã³ã¼ãã¬ãã¥ã¼ãè¡ã£ã¦ããã®ã§ãããã¼ã¸ã£ã¯ã©ã¹ã«ç解ã§ããæ¸ãæ¹ãããå¿ è¦ããã£ãããã21ä¸ç´ã«ãªã£ã¦ããé åã¯ä½¿ç¨ç¦æ¢ï¼ãã¨ããã³ã¼ãã£ã³ã°è¦ç´ãæ®ã£ã¦ãã¾ã£ãã
ãä¸æµã絡ã¾ãªãæè¡ã¯æ¯è¼çç°¡åã«æ·æ±°ã§ããããä¸æµã¯åºå®åãããç°¡åã«ã¯å¤ãããªãã
ãSQLã§å¦çããããæç¶ãåè¨èªã§å¦çãããã¯ãå ¨ä½æ¹éã«é¢ãã£ã¦ãããå ¨ä½ã«å½±é¿ãããããæè¡ãåãã£ã¦ãªãä¸æµãé¢ãããããç°¡åã«ã¯æ·æ±°ã§ããªããé常ã«é£ããåé¡ã®ä¸ã¤ã§ãã
ãããã¼ã¿ãã¼ã¹ãµã¼ãã§å¦çããæ¹ãããã¼ã¿ãã¼ã¹ãµã¼ãã®è² è·ãä¸ããã¾ããã¨ããã®ã¯ãåç´ãªè¨èã®å°è±¡ã¨ãã¦ééã£ãã¤ã¡ã¼ã¸ã«ãªããã¡ããã¨æè¡ãæãä¸ãã¦èããªãã¨ç解ã§ããªããããä¸æµã«ç«ã¤æè¡è ãä½ç¨æè¡ã«æãããªãã¨ç解ã§ããªãã
ãç解ã§ããªã人ã«åã£ã¦ã¯ãã·ã³ã°ã«ãã¤ã³ãã®ãã¼ã¿ãã¼ã¹ãµã¼ãã®è² è·ãä¸ããããï½ï½ï½ã¯ç¦æ¢ãã¨ããã®ãã¾ãã§æè¡çã«æ£ããã¨åéãããã¾ã¾é²ãã§ãã¾ãã
ãããã¸ã§ã¯ãã¯ãäºç®å ãç´æå ã«çµããã°æåãè¶ ããã°å¤±æã¨ãªããå¶æ¥åããã£ã¦ãã§ã£ããäºç®ã¨é·ããç´æãåã£ã¦ããããã©ããªããæ¹ã§ãæåããã§ããããæè¡åãã©ããªã«ãã°ãããã¦ããå¶æ¥åã¨ã®ãã©ã³ã¹ãæªããã°å¤±æã§ãæåããããã¸ã§ã¯ããããã°ãããã¯æåäºä¾ã¨ãªãã
ãã¤ã¾ããæåäºä¾ã¨ããã®ã¯æè¡çã«ã©ããã¯å ¨ãé¢ä¿ãªãã
ãã¨ããããæè¡çã«ééãã®ããæåäºä¾ãããã¨ãããã¯ééã£ãæè¡ãæ£ããã¨æãè¾¼ã¾ããã社å ã«æ ¹ä»ããããæ¥çã«åºããå¯è½æ§ãé«ããæè¡çã«æãããªééããããææ³ã§æåããããã¸ã§ã¯ãã¨ããã®ã¯ãå¶æ¥åã¯å¼·ãã£ããæè¡çã«ã¯ã¯ã½ã ã£ããã¨ãããã¨ã§ãã
ãããã«ãå®éã«ã¯æ®å¿µãªãã¨ã«ã¯ã½ä»¥ä¸ãããã
ãSQLã«ã¤ãã¦ã¯ã失æäºä¾ã®ä¸ã«ããããããSQLãåºæ¥ãªã人ã«æ¸ããã¦å¤±æãããã¨ããäºä¾ãå¤ãå«ã¾ãã¦ãããããä½è¨ã«ãSQLãé¿ããã¹ããã¨ããè«ã«åãæããã¦ãã¾ã£ã¦ããã®ãå®æ ãèª ã«æ ããªã話ã
ãã ããã¨ãã£ã¦ã巨大ã·ã¹ãã ã¯ãåºå®é·ã«ã©ã ãããããJOINã¯ä½¿ããªãæ¹ããããã¨ããæè¡çãªééããèªããããã«ã¯ãããªãã
ãæè¡çã«ã¯ã¯ã½ã ãã©ã
ããããã»ããããç解ã§ããªã
ããããã»äºç®ãåãã¦ãã
ããããã»ç´æãååã«ãã
ãã¨ããç¶æ³ä¸ã§æ¿æ²»çã«æ£è§£ã§ããã ãã§ã決ãã¦æè¡çã«ç®æããã®ã§ã¯ãªãã
ãæè¡çã«ã¯ã½ã§ããä¸æ¦ãæåäºä¾ã«ãã¦ãã¾ãã¨ããããæåã¨ãã¦åºå®ããã¦ãã¾ããã¨ã«ãªããããªããç§ã«ã¯ç解ãããããã¨ã§ãããSQLãé¿ããã¹ããã¨ããã®ããä¸é¨ã®ä¼ç¤¾ã§ã¯ãæ¢ã«æåã¨ãã¦æç«ããã¢ããªã®ã§ãããã
ã¦ã©ã¼ã¿ã¼ãã©ã¼ã«ãæåäºä¾ããæåã«ãªã£ã
ãä»ã«ããæåã¨ãã¦æç«ãã¦ãããã®ã«ãä¾ãã°ãã¦ã©ã¼ã¿ã¼ãã©ã¼ã«ãã¨ã¯ã»ã«æ¹ç¼ç´ãªã©ãããã
ããããã¯ãã©ããªã«å¹çãæªãã¦ãå¤ãã®æåäºä¾ãåå¨ããåºå®åãã¦æåã«ãªã£ã¦ãããããããç°¡åã«ã¯ã²ã£ããè¿ããã¨ã¯åºæ¥ãªãã
ãã¨ã¯ã»ã«æ¹ç¼ç´ã§ãä»ã¾ã§ãã®ãã©ã¼ãããã§ä»æ§æ¸ãæ¸ãã¦ãããä½ãæªãã®ãï¼åºæ¥ãªãã¨ããã®ãï¼ãã£ã¦è¨ãããããåºæ¥ãªããªããã©å¹çãâ¦â¦ãã£ã¦ç°¡åã«ã¯éããªãã§ãããããåºæ¥ãåºæ¥ãªãè«ãã«ãªãã¨ãã¦ã©ã¼ã¿ã¼ãã©ã¼ã«ï¼ã¨ã¯ã»ã«æ¹ç¼ç´ã§ã®æåäºä¾ãªãã¦ãããã§ããããããåã¦ãããããªãã®ã§ããæåãç²ä¿¡ãã¦ãã人ã¨ã¯è°è«ã«ãªããªãã
ãã¦ã©ã¼ã¿ã¼ãã©ã¼ã«ããã¨ã¯ã»ã«æ¹ç¼ç´ããæè¡çãªæ£ããã¯å ¨ãé¢ä¿ã®ãªãæåäºä¾ãããåå©ã®æ¹ç¨å¼ï¼ã¨åéãããï¼æåãå½¢æããã¦ãããWEBã³ã³ã·ã¥ã¼ãåãæååã«ãã¦ã©ã¼ã¿ã¼ãã©ã¼ã«ãã¨ã¯ã»ã«æ¹ç¼ç´ãå°ãªãã®ã¯ãæ°ããåºæ¥ãæååã ããã§ãå¤ãã£ã訳ã§ã¯ãªãã
ãåºå®åããæåãå¤ããã®ã¯å®¹æã§ã¯ãªãã
ãç°æåããè¦ãã°ãå¤æ´ãäºæ³ãããã®ã«ã¦ã©ã¼ã¿ã¼ãã©ã¼ã«ã¢ãã«ãæ¡ç¨ããã®ãããããããã¨ã¯ã»ã«ã表è¨ç®ã½ããã§ãªããæ¹ç¼ç´ã¨ãã¦ä½¿ãã®ããããããåãã£ã¦ãã人ã«åã£ã¦ã¯å½ããåã®ãã¨ãããããCOBOLããã®æåãç¶æ¿ãã¦ãã人ã«åã£ã¦ã¯ãæ´è¨ãã«ããèãããªãï¼ãããï¼ããã®ã¬ãã«ã ã¨ä¸æ¯ãªè°è«ã®çµé¨è ã¯æ¯è¼çå¤ããããç解ã§ãã人ãããã¨æãã
ããããã»é
åç¦æ¢
ããããã»ã¨ã¯ã»ã«æ¹ç¼ç´
ããããã»ã¦ã©ã¼ã¿ã¼ãã©ã¼ã«
ããããã»JOINç¦æ¢
ããããã»åºå®é·ã«ã©ã
ããããã»éè¨é¢æ°ç¦æ¢
ããããã»ãµãã¯ã¨ãªç¦æ¢
ãå·éã«æè¡ã¨æ¿æ²»ã®é¨åã«åãã¦èãã¦ã¿ãããæè¡çã«ã¯å ¨é¨ãç®ãè¦ããããªãã»ã©ããããããããã誰ãããã©ããã¯æ¿æ²»çã«åãå ¥ãããã¨ã¯ããã§ãããããããæè¡çã«æ£ããã¨åéããã¦ã¯ãããªãããã
ãæè¡çã«ããããã¨æããªãã¢ãããã人ã¯ãæåã¨ãã¦åãå ¥ãã¦æèåæ¢ã«ãªã£ã¦ãããå±éºãªå åã§ãã
ãRDBMSã使ãã®ã«SQLãé¿ããã®ãæè¡çã«ã¯ã©ããããããªãããããããå°ã£ããã¨ã«COBOLeræååããæ°ããWEBã³ã³ã·ã¥ã¼ãåãæååããã©ã¡ããããSQLãå«ãï¼ãå¤ãï¼ãã¨ããç¶æ³ã§ãç§ã«ã¨ã£ã¦ã¯åé¢æ¥æã®ç¶æ
ãç§ããããã¨ãæ´è¨ã«èããã人ã¯ãæ¢ã«ç°æåã®ä¸çã«ããã¨ãããã¨ã§ããããªãã®ããããæ¸ãã¦ãå¤ãã訳ããªãã¨ãããã¨ã¯ãæè¿ãããããåãã£ãã®ã§ããï¼è¦ç¬ï¼ã
ä¸æµï¼ä¸æµï¼è¨è¨ï¼å®è£ ï¼ã¨ããåãæ¹ããªãããã
ãããã§ãããã³ã»ããã¼ãã¨ãã¦ã¯å¤ãããã¨ããæãã¯å°½ããªãã
ããã®ããã«ã¯ãããããããä¸æµï¼ä¸æµï¼è¨è¨ï¼å®è£ ï¼ã¨ãããã§ã¼ãºã人å¡ã®åãæ¹ãããããã©ãããã¹ãã«ã«ãèãæ¹ã«ã大ããªéããããã®ã«ãã©ã¡ããã§éããå¸åããã®ã§ã¯ãªããUIå´ï¼DBå´ã¨ãã§ã¼ãºã人å¡ãåããã°ããã
ããã¡ãããæ´ã«ç´°ãããUIå´è¨è¨ï¼UIå´å®è£ ï¼DBå´è¨è¨ï¼DBå´å®è£ ã¨åãã¦ãããããã©ãã¨ã«ãããåã人ãUIå´ããDBå´ãåæã«æ å½ããã¨ããã®ã¯ç¡çãããããããã¿ãã§ãããä¸æµã«è¡ãã¨ã³ã¼ãã£ã³ã°ã®æ©ä¼ããªããªãã®ã«ãä¸æµã«çéã®ã¹ãã«ãæ±ãã¦ãç解åºæ¥ãããããªãã
ãå ¨ãéãã¹ãã«ãå¿ è¦ãªãã ãããã¹ãã«ã§ãã§ã¼ãºã人å¡ãåããã°ããã
ããã®ããã«DBå´ã¯ã¹ãã¢ãããã·ã¼ã¸ã£ã使ãã®ã§ãã
ãå
·ä½çãªããæ¹ã¯ããã¡ã
ããããhttp://d.hatena.ne.jp/Sikushima/20100831/1283221872
ããããhttp://d.hatena.ne.jp/Sikushima/20101201/1291171902
ãSELECTç³»ã¾ã§ã¹ãã¢ãããã·ã¼ã¸ã£ã«ãã¦ãUIå´ã«ã¹ãã¢ãããã·ã¼ã¸ã£ã®ã¹ã¿ããæä¾ããã°ããã§ã¼ãºãå®å
¨ã«åé¢ãã¦ãéçºããã¹ããå¯è½ã«ãªãã
ãã¤ã¾ããUIå´ã¯ãã¼ãã«ãªãã§ã³ã¼ãã£ã³ã°ã»ãã¹ãã¾ã§å®äºã§ããã
ãå ¨ãéãã¹ãã«ã両æ¹å¿ è¦ãªã®ã«ãã©ã¡ããä¸æ¹ã§ãããã¨ããã®ãééã£ã¦ããã
ãä¾ãã°ãJOIN ãæ¸ããããä½ãèµ·ãããåãããªãã¬ãã«ã®äººã«ãã¼ã¿ãæ±ãããªãã¦ã¨ãã§ããªãããããã人ã¯ãªããã§ãã£ããã UI ãä½ããã¨ã«æã£ã¦ããã®æ¹åã«é²ãã°ãããããªããã大ä½ããã£ã¡ã®æ¹ãåãã¦ãããããã£ã¡ãåãã¦ãªã人ã¯ä»æã®æ¥çã«è»¢è·ããæ¹ãããã
ãã¹ãã«ã§æ å½ãåãã¦ããäºããã¹ãã«ã磨ãã°ãããè¯ãã·ã¹ãã ãä½ããã¨ãå¯è½ã«ãªãããã£ã¨æ©ãããã£ã¨éãããã£ã¨å®ãã·ã¹ãã ãä½ããã¨ãåºæ¥ãã
ãç¾ç¶ã§SQLãåºæ¥ã人ã足ããªãã®ã¯åãã£ã¦ããã
ãããããéãã¦ãæåäºä¾ãã¨ãã¦ãã¾ãã°ããéãããã¨ããè¦ããªãæåã«ãªã£ã¦ã次ã®ä¸ä»£ã«å¼ãç¶ããããä¾ãã°ãã¨ã¯ã»ã«æ¹ç¼ç´ã£ã¦ãä»ã¨ãªã£ã¦ã¯ã誰ããä½ã®æå³ãæã£ã¦ããåºããããªãã¦åãããªãã§ãããã使ãã®ã¯çå±ãããªããå½ããåã ãããã¿ããªã使ããããã§ãããããããªãã¨è¦ããªãã®ãã
ã移è¡ããã«ã¯æåã¯å¤å°ã®è¦ãã¿ãããã ãããããããUIå´ã¨ãDBå´ã«åãããã¨ã§ãç¾ç¶ã®ãã³ã¼ãã£ã³ã°ãããã¨ããªãä¸æµãã¨ããåé¡ãå¾ã ã«ç·©åãããããããã¤ã¾ã§çµã£ã¦ããCOBOLã®ç»é¢ãWEBåããã ããã¿ãããªç¶æ³ããªããªã£ã¦ããã ããã
ãå¶æ¥çã»æ¿æ²»çãªæåã»å¤±æã¯ãç¾å®ä¸çã«ããã¦éè¦ã§ããã¯ã¦ãªæã§ãæè¡ããèªãã¨ãã«ã¯ä¸è¦ãªæ¦å¿µãæè¡ã¯ä¸ã«ãç¡éã«åºãã£ã¦ããã®ã§ãè¥ãæè¡è ãä¸ãåããªï¼
ãç§ä¸ä»£ã®å¹´å¯ãã¯ãè¥ãä¸ä»£ã®æè¡è ã«ãå¾æãªæ¹ãé¸ã¹ãç°å¢ãä½ã£ã¦ããã¹ãã§ã¯ãªããï¼
ãééã£ã¦ããéããå端ãªæè¡ãæåã«ãã¦ã¯ãããªãã