æ°èãåºã¾ãï¼ã¸ã§ã¼ã»ã»ã«ã³ãããã°ã©ãã®ããã®SQL 第4çã
ãçããããä¹ ãã¶ãã§ããé·ããããã°ã®æ´æ°ãæ¢ã¾ã£ã¦ããã®ã¯ãå°ã大ããªä»äºããã¦ããããã§ããã¸ã§ã¼ã»ã»ã«ã³ãããã°ã©ãã®ããã®SQL 第4çãã®ç¿»è¨³ãããã«éä¸ãããããããã°ããããTwitterããããï¼ãã£ã¡ã¯ã¡ãã£ã¨ãã£ã¦ãã¾ã£ãï¼é å¼µã£ã¦ããã¾ããã
ãé·ãã£ãã
ãæ¬å½ã«é·ãã£ãã
ãåèã800ãã¼ã¸ä»¥ä¸ããããå 容ãç°¡åã§ã¯ãªãã®ã§ããã¨ãã¨æ¥½ãªä»äºã¨ã¯æã£ã¦ãã¾ããã§ãããããã大å¤ã§ãããã§ããç¡äºä»æåè¡ã¨ãããªãã¾ããããã§ã«Amazonã¯ãããªã³ã©ã¤ã³ã·ã§ããã§ãäºç´åä»ãéå§ãã¦ãã¾ãããããããè¨ã£ã¦ããã¾ããã表ç´ã®ãã£ãã誰ï¼ãã¨ãã質åã¯ç§ã«ã¯ããªãããã«ãç§ãçããããªãã®ã§ï¼ç¬ï¼ã
ããã¦ãæ¬æ¸ã®å 容ãç´¹ä»ãã代ããã«ãå°ãé·ããªãã¾ãã訳è åæ¸ããå¼ç¨ãã¾ããè³¼å ¥ãããå¤æã®åèã«ãã¦ããã ããã°ã¨æãã¾ãããªããå®è¡ç°å¢ã¨ãã¦ã¯åæ¸ãã§ãæ¸ãã¦ãã¾ãããPostgreSQLãããããã§ãã
æ¬æ¸ã¯ãç±³å½ãã¼ã¿ãã¼ã¹çã代表ããã¨ã³ã¸ãã¢ã§ããã¸ã§ã¼ã»ã»ã«ã³æ°ã®èæ¸ãJoeCelkoâs SQL for Smartiesã第4 çã®é¦è¨³ã§ãããSQLã«é¢ãã¦ãããããä¸çã§æãç¶²ç¾ çãã¤ä½ç³»çã«è¨è¿°ãããæ¬ã§ãããã¾ãé«åº¦ã§å®è·µçãªãã¯ããã¯ãæºè¼ãã¦ãããã¨ãããè±èªåã§SQLãå¦ãã ãä»äºã§ä½¿ã人ã ã«ã¨ã£ã¦ã¯ãä¸åã®ãã¤ãã«ã¨ãã¦ä½ç½®ã¥ãããã¦ããæ¬ã§ããã
ãåæ¸ç¬¬2çã®é¦è¨³ã¯ã2001å¹´ã«ãã¢ã½ã³ã»ã¨ãã¥ã±ã¼ã·ã§ã³ããåè¡ããããããããã第3çãé£ã°ãã¦ãä¹ ã ã®è¨³åºã¨ãªããèè ãè¿°ã¹ãããã«ããã®éã®SQLã®é²æ©ã«ã¯ç®è¦ãããã®ããããæ¬æ¸ãSQLã®æ°æ©è½ã«å¯¾å¿ããã¹ãå¤§å¹ ãªã¢ããã°ã¬ã¼ããè¡ããã¦ããããæ°ããSQLããå¦ã¶ãã¹ã¦ã®äººã«ã¨ã£ã¦ã®å°ãã®æ¸ã¨ãªãã«ç¸å¿ããéåãªå 容ã§ãããæ¬æ¸ã訳åºã§ãããã¨ã¯ãä¸äººã®DBã¨ã³ã¸ãã¢ã¨ãã¦é常ã«å¬ããæãã
ããã¦ãæ¬æ¸ãèªã人ã ã®ããã«ãããã§æ¬æ¸ã®å 容ã«ã¤ãã¦ç°¡åãªã¬ã¤ããè¡ããããæ¬æ¸ã¯ãå ¨39 ç« ãããªããã大ããååã¨å¾åã«åãããããååã¯ç¬¬12ç« ã¾ã§ãå¾åã¯ç¬¬13ç« ä»¥éã§ãããååã¯ä¸»ã«SQLããã³ãªã¬ã¼ã·ã§ãã«ãã¼ã¿ãã¼ã¹ã®åºç¤çãªæ¦å¿µãçè«çæ çµã¿ã«ã¤ãã¦ã®è§£èª¬ãè¡ããããå¾åã¯ããããè¸ã¾ããããã§SQLã®æã¤å¤å½©ãªæ©è½ã®è§£èª¬ã¨é«åº¦ãªå¿ç¨ãã¯ããã¯ãç´¹ä»ããããåºæ¬çã«ã¯ç¬¬1ç« ããé ã«èªãã§ããã·ã¼ã±ã³ã·ã£ã«ãªèªã¿æ¹ã§ãã¾ããªãããããèªè ãæã£åãæ©ãSQLã®ãã¯ããã¯ãç¥ãããããããã¯ååããã©ãã©ããã£ã¦ã¿ã¦ãå 容ãããç¨åº¦æ¿ç¥ãã¦ããã¨æãããªãã°ã第13ç« ããèªã¿å§ãã¦ãé©å®å¿ è¦ãªååãåç §ãããã¨ããèªã¿æ¹ããã¦ãããã第13ç« ã¯æ£ç¢ºã«ã¯SQLã®ãã¯ããã¯ã解説ããç« ã§ã¯ãªãããå¿ ããã¹ã¦ã®èªè ã«èªãã§ãããããããæ¬æ¸ã®ä¸ã§æãéè¦ãªç« ã¯ï¼ãã¨è¨ããããããè¿·ãã第13ç« ã¨çããã ããã
ã第12ç« ã¾ã§ã®ååã§ã¯ããã¼ãã«ããã¥ã¼ãããã·ã¼ã¸ã£ãããªã¬ã¼ã¨ãã£ããã¼ã¿ãã¼ã¹ã§æ±ããããªãã¸ã§ã¯ããSQLã®ãã¼ã¿åãããã³å¶ç´ã¨ãã£ãæ¦å¿µãæ±ãããããã®ã¨ãæ ¸ã¨ãªãã®ã¯ããªã¬ã¼ã·ã§ãã«ã¢ãã«ã¨ããã¡ã¤ã«ã·ã¹ãã ãæç¶ãåã«åºç¤ãæã¤è¨èªã¨ã®èãæ¹ã®éãã§ãããç§ãã¡ã¯ã¾ããããããä¼çµ±çãªè¨èªã§èº«ã«ã¤ããèãæ¹ããã£ããå¿ãã¦ãã¾ã£ããæ°ãã観ç¹ã§ç©äºãè¦ããã¨ãè¦æ±ãããï¼SQLã«éãããä½ã®åéã§ããããããä¸çªé£ãã奥義ãªã®ã ãï¼ã第13ç« ä»¥éã§ã¯ãEXISTSãLIKEãçµåãHAVINGãã¦ã£ã³ãã¦é¢æ°ãCASEå¼ã¨ãã£ããSQLã®æã¤å¼·åãªæ¦å¨ã®å¤å½©ãªå¿ç¨æ¹æ³ãå¦ãã§ããã
ããªããæ¬æ¸ã§ã¯ããããã¢ããªã³ã°ãæ£è¦åã«ã¤ãã¦ã¯ã»ã¨ãã©è§¦ããããªããæ£è¦åã«ã¤ãã¦ã¯ç¬¬9ç« ã§åãä¸ãã¦ãããã主ã«çè«ç解説ã«ã¨ã©ã¾ããå®è·µçãªã±ã¼ã¹ã¹ã¿ãã£ãªã©ã¯æ±ãããªããã¾ãããã©ã³ã¶ã¯ã·ã§ã³ãåæå®è¡å¶å¾¡ã«ã¤ãã¦ãã第2ç« ã§ç°¡åã«è§¦ããããã®ã¿ã§ããããããããããã¼ãã«ã¤ãã¦ã¯å¥ã«é©åãªæ¸ç±ã«ããã£ã¦ãããããã
ãã¾ããæ¬æ¸ã¯ååã¨ãã¦æ¨æºSQL ã«æºæ ããæ§æã§æ¸ããã¦ãããããåºæ¬çã«ã¯ç¹å®ã®DBMSã«ä¾åããªãSQLãå¦ã¶ãã¨ãã§ããããåºæ¬çã«ã¯ãã¨çä¿ãä»ããã®ã¯ãæ¨æºSQLã«å¯¾ããæºæ ã®ã¬ãã«ã¯å®è£ ã«ãã£ã¦ãã©ã¤ãããããç¹å®ã®DBMSã§ã¯ãã®ã¾ã¾ã®å½¢ã§ã¯ä½¿ããªãæ§æãå«ã¾ãã¦ããããã ããã®ãããªå ´åã¯ãé©å®è¨³æ³¨ã«ã¦èª¬æãè£ã£ã¦ããã®ã§åèã«ãã¦ããããããé¡ããã°ã次ã®çã§ã¯ãã®ãããªè¨³æ³¨ã®æ°ãæ¸ã£ã¦ã»ãããã®ã ãã¡ãªã¿ã«ãæ¬æ¸ã®ãµã³ãã«ã³ã¼ãããã®ã¾ã¾ã®å½¢ã§æãå¤ãå®è¡ã§ããå®è£ ã¯ãããããPostgreSQLã§ãããï¼ç¿»è¨³æã«åä½ç¢ºèªç°å¢ã¨ãã¦PostgreSQL 9.1.1ã使ç¨ããï¼ã
ããã ããä¾å¤çã«ã¹ãã¢ãããã·ã¼ã¸ã£ããã¡ã³ã¯ã·ã§ã³ã«ã¤ãã¦ã¯ãOracle Database ã®PL/SQLã«ããæ§æãæ²è¼ãã¦ããããã®çç±ã¯ãæ¨æºSQLã«ããæ§æã¯ã©ã®å®è£ ã§ãåä½ããªããããåèã«æ²è¼ããã¦ããããã·ã¼ã¸ã£ããã¡ã³ã¯ã·ã§ã³ã®ãµã³ãã«ã³ã¼ããåãããå®è£ ããªãã£ãããã§ãããããã§æ¬æ¸ã§ã¯ãåããªãã³ã¼ããè¼ããããã¯å®éã«åãã³ã¼ãã®ã»ããããã¨èããã·ã§ã¢ã®é«ãDBMSã§ããOracle Databaseã®PL/SQLãæ¡ç¨ããï¼æªããã¨ã«ãããã·ã¼ã¸ã£ããã¡ã³ã¯ã·ã§ã³ã®æ§æã¯DBMSéã§ããã©ãã©ã§ããï¼ã
ãæåã«è¿°ã¹ãããã«ãæ¬æ¸ã¯SQLã®æç§æ¸ã¨ãã¦ã¯çããªãæé«å³°ã®æ°´æºã§ãããã ãããã ãã«ãæ¬æ¸ãèªã¿é²ããã®ã«é£ãããæãã人ããããããããªãããã®å ´åã¯ããããã¦èªããã¨ãæ¨å¥¨ãããæ¬ãããã1ã¤ã¯ãåãèè ã«ãããSQLããºã« 第2çãï¼ç¿æ³³ç¤¾ã2007ï¼ã§ãããããã¯ããã¾ãã¾ãªããºã«ãéãã¦SQLã®ãã¯ããã¯ã身ã«ã¤ããã¨ãããããã°ãç·´ç¿åé¡éãã«ãããæ¬ã§ããããã1 ã¤ããæèãé人ã«å¦ã¶ SQLå¾¹åºæåæ¸ãï¼ç¿æ³³ç¤¾ã2008ï¼ã§ãããããã¯ããã¨ãã¨æ¬æ¸ã®ç解ãå©ããããã®ãå¯èªæ¬ãã¨ãã¦æ¸ãããã®ã§ãããèå¿ã®æç§æ¸ã®ç»å ´ãä¸çªé ãã¦ãã¾ã£ãããã¨ããããããã§æç§æ¸ãåé¡éãå¯èªæ¬ãæã£ããã¨ã«ãªãã
ãæå¾ã«ãæ¬æ¸ãè²·ããã©ããè¿·ã£ã¦ãã人ã«å¯¾ãã¦ãå¤æã®æéãä¸ãããããããã©ãã©ã¨ããã£ã¦ã¿ã¦ããããã¯ã¡ãã£ã¨ãã¾ã æ¯ãç«ããªããã ãã¨æãããªãã°ããã£ããæ¬æ¸ãæ£ã«æ»ãåãèãã¦ããæ»ã£ã¦ãããã¨ããã®ã¯è³¢æãªå¤æã§ãããèè ãè¨ãããã«ãæ¬æ¸ã¯ãä¸è¾ã«ãåå¿è ã«åªããæ¸ãæ¹ã¯ãã¦ããªããã ããããæ¬æ¸ã®å¤æ®µãè¦ã¦èºèºãã¦ãããªãã°ãééããªãæ¬æ¸ã¯ãè²·ããã§ããã¨èä¸ãæ¼ããããã¨ããã®ããè¦ããã®å¤æ®µã«åãã¦ãå®ã¯æ¬æ¸ã¯ãå®ããæ¬ã ããã ããã®çç±ã¯ãæ¬æ¸ãã¨ãã¨ãèªã¿è¾¼ãã§ãã¾ãã°ããã¨ã¯ä¸éå端ãªSQLã®åèæ¸ãªã©1åãèªãå¿ è¦ããªããªãããã ããã®ç¹ã§ãæ¬æ¸ã¯é常ã«ãã³ã¹ããã®è¯ãæ¬ãªã®ã ã
ãæ¬æ¸ãæ¥æ¬ã®ãã¼ã¿ãã¼ã¹ã¨ã³ã¸ãã¢ã«ã¨ã£ã¦ãå°ãã®æ¸ã¨ãªããã¨ãç¥ã£ã¦ãã¾ãã