1. SQLãšã¯äœã
SQLïŒãšã¹ãã¥ãŒãšã«ïŒã¯ããªã¬ãŒã·ã§ãã«ããŒã¿ããŒã¹ç®¡çã·ã¹ãã ïŒRDBMSïŒçšã«éçºãããåœéæšæºåãããããã°ã©ã èšèªã§ããããã¯ãããŒã¿ãä¿åãååŸãæŽæ°ãåé€ããããã«äœ¿çšãããŸãã
ããŒã¿ããŒã¹ã®å¶åŸ¡èšèªãšããããSQLã¯ãããŒã¿ããŒã¹å ã§å¹ççãªæ€çŽ¢ãšæäœãå¯èœã«ããŸããSQLã®éèŠãªç¹åŸŽã®äžã€ã¯ãã©ã®ããŒã¿ããŒã¹ã§ã䜿çšã§ãããšããæ®éæ§ã§ãã
次ã«ãSQLã®ããæ·±ã解æã«é²ã¿ããã®èµ·æºã圢ç¶ãç¹åŸŽãåé¡ããããŠãã®èŠæ Œã«ã€ããŠè©³ãã説æããŠãããŸãã
1.1 SQLã®å®çŸ©
SQLã¯Structured Query Languageã®ç¥ã§ãçŽèš³ãããšãæ§é ååãåããèšèªãã§ããSQLã¯ããªã¬ãŒã·ã§ãã«ããŒã¿ããŒã¹ç®¡çã·ã¹ãã ïŒRDBMSïŒãšããŒã¿ãããåãããããã®éå ·ãšããŠèšèšãããŸããã
SQLã§ã¯ãããŒã¿ããŒã¹ã«ããŒã¿ãä¿åããããããŒã¿ãåãåºããŠåæããããããŒã¿ãæŽæ°ããããããã«ã¯ããŒã¿ããŒã¹ã®æ§é èªäœãæäœãããããããšãªã©ãå¯èœã§ãã
ããããªãããSQLã¯å®è¡å¯èœãªããã°ã©ã ãäœæããããã®äžè¬çãªããã°ã©ãã³ã°èšèªãšã¯ãããŸãããSQLã¯ãããŸã§ãããŒã¿ããŒã¹å ã®ããŒã¿ãžã®åãåãããšæäœãè¡ãããã®å°çšèšèªã§ããããã®ç®çã¯å¹ççãªããŒã¿ç®¡çã®ããã§ãã
1.2 SQLã®èµ·æºãšçºå±
SQLã¯1970幎代ã«IBMã®ç 究è ã«ãã£ãŠéçºãããŸãããããŒã¿ããŒã¹ã®ç®¡çãšåãåããã®å¹çåãç®æããåŸæ¥ã®éå±€åããããã¯ãŒã¯åããŒã¿ããŒã¹ã§ã¯é£ããã£ãè€éãªããŒã¿æäœãå¯èœã«ããããã«èšèšãããŸããã
ãã®åŸãSQLã¯é·å¹Žã®éã«å€ãã®æ¹è¯ãå ããããä»æ¥ã§ã¯åœéæšæºã«ãªã£ãŠããŸãããŸããæ°å€ãã®ããŒã¿ããŒã¹ã·ã¹ãã ã®æ žã«ããªã£ãŠãããåçšããŒã¿ããŒã¹ã·ã¹ãã ã¯ãã¡ããããªãŒãã³ãœãŒã¹ã®ããŒã¿ããŒã¹ã·ã¹ãã ã§ã䜿çšãããŠããŸãã
SQLã®éèŠæ§ãšåœ±é¿åã¯å¹Žã å¢å ããŠããŸããç¹ã«è¿å¹Žã§ã¯ãããã°ããŒã¿ã®æ代ã«ãããŠããŒã¿åæãšæ å ±æœåºã®éèŠãå¢å€§ããŠãããããSQLã®éèŠæ§ã¯ãŸããŸãå¢ããå¢ããŠããŸãã
1.3 SQLã®åœ¢åŒãšç¹åŸŽ
SQLã®åœ¢åŒã¯ç¬ç¹ã§ããã®äž»ãªãã®ã«ã¯DMLãDDLããããŠDCLããããŸããããããç°ãªãç®çãæã¡ãããŒã¿ã®æäœãå¯èœã§ãã
ç¹ã«ãSQLã®æ倧ã®ç¹åŸŽãšããŠã¯ãã®éæç¶ãåã®æ§æ ŒãæããããŸããSQLã¯ãäœãããããã®ããæå®ããããããã©ã®ããã«ãå®çŸãããã¯ããŒã¿ããŒã¹ç®¡çã·ã¹ãã ïŒDBMSïŒã決å®ããŸãã
ãã®ç¹åŸŽã«ãããSQLã§ã¯ãŠãŒã¶ãŒãæç¶ããæå®ããããšãªããç°¡åã«å€§éã®ããŒã¿ãé«éã«åŠçããããšãå¯èœã«ãªã£ãŠããŸãã
1.4 SQLã®èŠæ Œãšèšèªã®çš®é¡
SQLã¯ã¢ã¡ãªã«èŠæ ŒåäŒïŒANSIïŒã«ãã£ãŠ1986幎ã«åããŠèŠæ ŒåãããŸããããã®åŸãäœåºŠãæ¹çãéããããæ©èœã匷åãããŠããŸãããçŸåšã§ã¯ãSQLã¯ISOïŒIECãšANSIã®å ±åèŠæ ŒãšããŠååšããŠããŸãã
ãŸããSQLã¯æ§ã ãªèšèªã®çš®é¡ãååšããŸããããããã®èšèªã®çš®é¡ã¯ããã®äœ¿çšç®çã«ãã£ãŠç°ãªããŸããäŸãã°ãããŒã¿æäœèšèªïŒDMLïŒã¯ããŒã¿ã®ååŸãç»é²ãæŽæ°ãåé€ãè¡ãã®ã«äœ¿çšãããããŒã¿å®çŸ©èšèªïŒDDLïŒã¯ããŒã¿ããŒã¹ã®ããŒãã«ã®äœæãåé€ãå€æŽãªã©ãè¡ãã®ã«äœ¿çšãããŸãã
ãŸããããŒã¿å¶åŸ¡èšèªïŒDCLïŒã¯ããŒã¿ã®ã»ãã¥ãªãã£ãæŽåæ§ã䞊è¡å¶åŸ¡ãªã©ã®ç®¡çãè¡ãã®ã«äœ¿çšãããŸãããããã®SQLã®æ§ã ãªææ³ãç解ããŠå¹ççã«äœ¿çšããããšã§ãæ±çšæ§ã®é«ãããŒã¿æäœãå¯èœã«ãªããŸãã
2. SQLã§äœãã§ããã
SQLã¯ããŒã¿ããŒã¹æäœã®ããã®åœéæšæºåãããããã°ã©ã èšèªã§ããã®çšéã¯å€å²ã«ããããŸãã以äžã§ã¯ãSQLã§å¯èœãªäž»èŠãªæäœã«ã€ããŠè§ŠããŠãããŸãã
2.1 ããŒã¿ã®ååŸã»ç»é²ã»æŽæ°ã»åé€
ããŒã¿ããŒã¹ãšã¯å€§éã®ããŒã¿ãå¹çããæ±ãããã®ä»çµã¿ã§ãããSQLã¯ãã®æ žå¿çãªåœ¹å²ãæ ã£ãŠããŸããSQLã«ãã£ãŠãããŒã¿ããŒã¹å ã®ããŒã¿ãååŸããããæ°ãã«ç»é²ãããããããšãå¯èœã§ãããŸãããã§ã«ååšããããŒã¿ã®æŽæ°ãåé€ãè¡ãããšãã§ããŸãã
ãããã®æäœã¯SQLã®DMLïŒããŒã¿æäœèšèªïŒã«å«ãŸããSELECTæãUPDATEæãDELETEæãINSERTæãªã©ã䜿ãããªãããšã§è¡ããŸãã
ãããŸã§SQLã¯ããã°ã©ã èšèªã§ãããæäœããããŒã¿ããŒã¹ãMySQLã§ãã£ãŠããOracleã§ãã£ãŠããåºæ¬çã«ã¯åãSQLã䜿çšããããšãã§ããŸãã
2.2 æ¡ä»¶æ€çŽ¢
ããŒã¿ããŒã¹ã«ä¿åãããŠããããŒã¿ã¯èšå€§ã§ãããããç¹å®ã®ããŒã¿ãåŒãåºãããã«ã¯ãå¹æçãªæ€çŽ¢æ¹æ³ãå¿ èŠã§ãããã®ããã®æ段ãšããŠSQLã§ã¯æ¡ä»¶æ€çŽ¢ãå¯èœã§ãã
SQLã®SELECTæã«WHEREå¥ã䜿çšããããšã§ãç¹å®ã®æ¡ä»¶ã«äžèŽããããŒã¿ã ããååŸããããšãã§ããŸãããã®æ©èœã«ãããå¿ èŠãªããŒã¿ã ããå¹çããåãåºãããšãã§ããŸãã
ããã«ãè€æ°ã®æ¡ä»¶æå®ã䞊ã³æ¿ãïŒãœãŒãïŒãªã©ãããŸããŸãªæ€çŽ¢æ¡ä»¶ã®çµã¿åãããå¯èœã§ãã
2.3 ããŒãã«ã®æäœ
ããŒã¿ããŒã¹å ã«æ ŒçŽãããããŒã¿ã¯ãããŒãã«ãšåŒã°ãã圢åŒã§ç®¡çãããŸããSQLã§ã¯ãããã®ããŒãã«ã®äœæãåé€ãæ§é ã®å€æŽãšãã£ãæäœãå¯èœãªã®ã§ãã
ãããã®æäœã¯SQLã®DDLïŒããŒã¿å®çŸ©èšèªïŒãšåŒã°ããCREATEæãDROPæãALTERæã䜿çšããŸãã
ããŒãã«æäœã¯ããŒã¿ããŒã¹èšèšãããŒã¿ããŒã¹æ§é ã®å€æŽãªã©ãã·ã¹ãã éçºãéçšã®äžã§é »ç¹ã«è¡ãããäœæ¥ã§ãSQLã¹ãã«ãããããšã¯å€§å€éèŠã§ãã
2.4 ããŒã¿ããŒã¹ã®ç®¡çã»æäœ
SQLã¯åã«ããŒã¿ã®æäœã ãã§ãªããããŒã¿ããŒã¹ãã®ãã®ã®ç®¡çã»æäœãæ åœããŸããããã¯SQLã®DCLïŒããŒã¿å¶åŸ¡èšèªïŒãšåŒã°ããéšåã§ãæš©éã®ä»äžãåãæ¶ãããã©ã³ã¶ã¯ã·ã§ã³ã®å¶åŸ¡ãšãã£ãæäœãå¯èœã§ãã
å ·äœçã«ã¯ãGRANTæãREVOKEæã§ããŒã¿ããŒã¹ã®å©çšæš©éãèšå®ããããCOMMITæãROLLBACKæã§ããŒã¿ã®æŽæ°ç¶æ³ãå¶åŸ¡ããããšãã§ããŸãã
ãããã®æ©èœã¯ãããŒã¿ããŒã¹ãå®å šãã€å¹ççã«éçšããäžã§å¿ èŠäžå¯æ¬ ãªãã®ã§ãããSQLãæã€å€æ©èœæ§ã象城ããŠããŸãã
3. SQLã®äž»ãªææ³
ããŒã¿ããŒã¹æäœã«å¿ é ãªSQLã§ããããã®ææ³ã¯äž»ã«DMLïŒããŒã¿æäœèšèªïŒãDDLïŒããŒã¿å®çŸ©èšèªïŒãDCLïŒããŒã¿å¶åŸ¡èšèªïŒã®3ã€ã«åããããŸããããããã®èšèªã«ã¯ç¹ç°ãªåœ¹å²ããããããããã䜿ãåããããšã§å¹ççã«ããŒã¿ããŒã¹ãæäœããããšãã§ããŸãã
ãŸããããã§ã¯åèšèªã®åºæ¬çãªææ³ã«å ããŠãSQLã®æ§æèŠåã«ã€ããŠã觊ããŠã¿ãŸãã
3.1 DMLïŒããŒã¿æäœèšèªïŒã®ææ³
DMLã¯ãããŒã¿ããŒã¹å ã®ããŒã¿ãæäœããããã®èšèªã§ããäž»ãªææ³ã«ã¯SELECTæãUPDATEæãDELETEæãINSERTæããããŸãã
äŸãã°SELECTæã¯ãããŒã¿ãååŸããããã®æã§ããSELECT * FROM ããŒãã«å;ãšãã£ã圢ã§äœ¿çšããŸãã
ãŸããINSERTæã¯æ°ããªããŒã¿ãç»é²ããããã®ææ³ã§ããINSERT INTO ããŒãã«å (åå) VALUES (å€);ãšãã圢ã§äœ¿çšããŸãã
3.2 DDLïŒããŒã¿å®çŸ©èšèªïŒã®ææ³
DDLã¯ããŒã¿ããŒã¹ãããŒãã«ã®å®çŸ©ãäœæãå€æŽãåé€çãè¡ãèšèªã§ããCREATEæãDROPæãALTERæãäž»ãªææ³ã§ãã
CREATEæã¯ããŒã¿ããŒã¹ãããŒãã«ãäœæããéã«äœ¿çšããŸããCREATE DATABASE ããŒã¿ããŒã¹å;ãCREATE TABLE ããŒãã«å;ãšãã£ã圢ã§äœ¿çšããŸãã
äžæ¹ãDROPæã¯ããŒã¿ããŒã¹ãããŒãã«ãåé€ããéã«äœ¿çšããŸããDROP DATABASE ããŒã¿ããŒã¹å;ãDROP TABLE ããŒãã«å;ãšãã£ã圢ã§äœ¿çšããŸãã
3.3 DCLïŒããŒã¿å¶åŸ¡èšèªïŒã®ææ³
DCLã¯ããŒã¿ããŒã¹ã®ã»ãã¥ãªãã£ããã©ã³ã¶ã¯ã·ã§ã³ã®ç®¡çãè¡ãããã®èšèªã§ããGRANTæãREVOKEæãCOMMITæãROLLBACKæãäž»ãªææ³ã§ãã
GRANTæã¯ä»ã®ãŠãŒã¶ãŒã«å¯ŸããŠããŒã¿ããŒã¹ã®ç¹å®ã®æäœãèš±å¯ããå Žåã«äœ¿çšããŸãããŸããREVOKEæã¯èš±å¯ãåãæ¶ãéã«äœ¿çšããŸãã
ãã©ã³ã¶ã¯ã·ã§ã³ã®ç¢ºå®ãšåãæ¶ããè¡ãã«ã¯ãCOMMITæãšROLLBACKæã䜿çšãããŸããããããé©åã«äœ¿çšããããšã§ãããŒã¿ã®æŽåæ§ãä¿ã€ããšãã§ããŸãã
3.4 SQLã®æ§æèŠå
SQLã®æ§æã¯åºæ¬çã«å€§æåå°æåãåºå¥ããããåœä»€èªã«ã¯è±èªã®åèªãäž»ã«äœ¿ãããŸããåºæ¬çãªèšè¿°é åºãšããŠã¯ããåœä»€èª ãªããžã§ã¯ãå æ¡ä»¶ãã§ãã
äŸãã°ãããŒã¿ãåãåºãSELECTã®å ŽåããSELECT åãåºãããã«ã©ã å FROM ããŒãã«å WHERE æ¡ä»¶ãã®ãããªé åºã§èšèŒããŸãã
æåŸã«ãåœä»€æã®æåŸã«ã¯ã»ãã³ãã³ïŒ;ïŒãèšè¿°ããåœä»€ã®çµäºã瀺ããŸããSQLã®æ§æèŠåãç解ããå¹ççã«ããŒã¿ããŒã¹ãæäœããã¹ãã«ã身ã«ã€ããŸãããã
4. SQLåŠç¿ã®ã¡ãªãã
ããŒã¿ããŒã¹æäœã«äžå¯æ¬ ã§ããSQLãåŠã¶ããšã§åŸãããã¡ãªããã¯å€§ããã§ããããã¯ãšã³ãžãã¢ã§ããéãšã³ãžãã¢ã§ãããããŒã¿æäœã®èªç±ãæã«å ¥ããããšã§ãåé¡è§£æ±ºã®å¹ ãåºããããã§ããããã«ãæ°ããªè·çš®ã®éãéããŸãã
4.1 ãšã³ãžãã¢ãšããŠã®ã¡ãªãã
ãšã³ãžãã¢ãšããŠã®SQLåŠç¿ã®äžçªã®ã¡ãªããã¯ãã¢ããªéçºæã«ããŒã¿ããŒã¹æäœãå¯èœã«ãªãããšã§ãããŸããSQLã䜿ãããªãããšãã§ããã°ããŒã¿ããŒã¹ãå®å šãã€å¹ççã«ç®¡çã§ããŸãããããã¯ãšã³ãžãã¢ã«å¿ èŠäžå¯æ¬ ãªã¹ãã«ãšãªã£ãŠããŸãã
ããã«ãSQLã®ãã¯ããã¯ã身ã«ã€ããããšã«ãããããŒã¿ããŒã¹ãšã³ãžãã¢ãžã®éãéãããŸããããŒã¿ããŒã¹ãšã³ãžãã¢ã¯ãããŒã¿ããŒã¹ã®èšèšãæ§ç¯ã管çãæé©åãæ åœããå°é家ã§ããã®é絊ã¯é«ãŸãç¶ããŠããŸãã
4.2 éãšã³ãžãã¢ãšããŠã®ã¡ãªãã
ãŸããéãšã³ãžãã¢ã«ãšã£ãŠãSQLã®ç¿åŸã¯å€§ããªã¡ãªããããããŸãããšã³ãžãã¢ã«äŸåããã«ãèªåã§ããŒã¿ãæœåºãåæã§ãããããããèªç±åºŠã®é«ãåæãå¯èœã«ãªããŸããããã«ãããããžãã¹ã®ææ決å®ã«çŽçµããããŒã¿ãå¹ççã«æ±ãããšãå¯èœã«ãªããŸãã
ããã«ãSQLãç解ããŠããã°ãšã³ãžãã¢ãšã®ã³ãã¥ãã±ãŒã·ã§ã³ãã¹ã ãŒãºã«ãªããŸããå ·äœçãªããŒã¿æäœã®èŠæ±ãåºãããšãã§ããããããããžã§ã¯ããé²è¡ããé床ãäžãããŸãã
4.3 SQLç¿åŸè ãç®æãããšãã§ããè·çš®
SQLãç¿åŸããããšã§ãããŒã¿ããŒã¹ãšã³ãžãã¢ãããŒã¿ãšã³ãžãã¢ãšãã£ãæ°ããªè·çš®ã«ææŠããããšãå¯èœã§ããããŒã¿ããŒã¹ãšã³ãžãã¢ã¯ãããŒã¿ããŒã¹ã®èšèšãæ§ç¯ã管çãéçšãæ åœããŸããããŒã¿ãšã³ãžãã¢ã¯ã倧éã®ããŒã¿ãæ±ãããã®ã€ã³ãã©ãèšèšã»æ§ç¯ã»éçšãã圹å²ãæ ããŸãã
ãããã®è·çš®ã¯ãããŒã¿ããªãã³ãªããžãã¹ã®éèŠæ§ãé«ãŸãçŸä»£ã§ã¯ãéåžžã«æ±ããããã¹ãã«ã»ãããæã£ãŠããŸãã
4.4 SQLã®å°æ¥æ§ãšåžå ŽäŸ¡å€
ããžã¿ã«ãã©ã³ã¹ãã©ãŒã¡ãŒã·ã§ã³ãé²ãçŸä»£ã«ãããŠãSQLãåŠã¶ããšã®åžå ŽäŸ¡å€ã¯ãŸããŸãé«ãŸã£ãŠããŸãã倧éã®ããŒã¿ããæçãªæ å ±ãã²ã解ãèœåã¯ãåéšéãããŒã¿ã«åºã¥ããŠææ決å®ãããçŸä»£ããžãã¹ã®äžæ žãæããŠããŸãã
ãããŠãSQLãããŒã¿æäœã®ãäžçå ±éèªãã§ããç¶ããéãããã®äŸ¡å€ã¯ç¶æãããŸããããŒã¿ããŒã¹ã®çš®é¡ãå¢ãããšããŠãããããã¯SQLã«ããæäœããµããŒããç¶ããŸãããã®ãããSQLãç¿åŸããŠããããšã¯ãå°æ¥æ§ãæã€æè¡ã¹ãã«ã§ãããšèšããã§ãããã
5. SQLã®åŠç¿æ¹æ³ãšè³æ
SQLããã¹ã¿ãŒããäžã§ãåŠç¿æ¹æ³ãåèè³æã«ã€ããŠç解ããŠããããšã¯æ¬ ãããŸããããªã³ã©ã€ã³ã§ã®åŠç¿ãæžç±ã䜿ã£ãåŠç¿ããããŠè³æ ŒååŸãžã®ææŠãåºæ¬çãªåŠç¿æ¹æ³ãšãªããŸãã
ãŸããããããã®åŠç¿æ¹æ³ã ãã§ãªããã©ã®ãããªå匷æ³ãæå¹ããã¢ããã€ã¹ã«ã觊ããŠãããŸãã
ããã§ã¯äžã€ãã€èŠãŠãããŸãããã
5.1 ãªã³ã©ã€ã³åŠç¿ãµã€ãã§åŠã¶
ãŸãããªã³ã©ã€ã³åŠç¿ãµã€ãã¯ååŠè ã«ãšã£ãŠæéãå Žæãéžã°ãèªåã®ããŒã¹ã§åŠã¹ãæé©ãªããŒã«ã§ããProgateã®SQLã³ãŒã¹ããããã€ã³ã¹ããŒã«ã®MySQLãªã©ãååŠè ã«ããããã§ãã
ãããã®ãµã€ãã§ã¯ãåºæ¬çãªSQLã®ææ³ããå®éã®ããŒã¿æäœãŸã§ãäžé£ã®æµããé çªã«åŠã³ãªããæäœã§ããŸãã
ãŸããå¯èœãªéãå®éã®äœæ¥ç°å¢ã«è¿ãç¶æ ã§åŠã¹ããããçŸå Žã§ã®SQLæäœã«ããã«å¿çšã§ããŸãã
5.2 æžç±ã§åŠã¶
次ã«ãæžç±ã«ããåŠç¿ã§ããèªåã®ããŒã¹ã§ãã£ãããšåŠã¹ãæžç±ã¯ãç解ãæ·±ããã®ã«æé©ã§ãã
ååŠè ããäžçŽè ãŸã§ãèªåã®ã¬ãã«ã«åãããŠéžã¶ããšã倧åã§ãã
ç¹ã«ã詳现ãªè§£èª¬ãè±å¯ãªäŸé¡ãæ²èŒãããŠããæžç±ã¯ãç解ãæ·±ããã®ã«åœ¹ç«ã¡ãŸãã
5.3 è³æ ŒååŸã«ãã£ã¬ã³ãžãã
ãããŠãè³æ ŒååŸãžã®ææŠã§ããè³æ Œã¯ãèªèº«ã®ã¹ãã«ã客芳çã«èšŒæããã ãã§ã¯ãªããåŠç¿ã®é²æ管çãç®æšèšå®ã«ã圹ç«ã¡ãŸãã
SQLã«é¢é£ããè³æ Œã«ã¯ãIPAããŒã¿ã¹ãã·ã£ãªã¹ãè©Šéšããªã©ã¯ã«ãã¹ã¿ãŒãOSS-DBæè¡è èªå®ãªã©ããããŸãã
ãããã®è©Šéšã¯ãå®éã®ããžãã¹ã¹ãã«ãè©äŸ¡ãããã®ã§ãããåæ Œããã°æ¥çã§ã®ä¿¡é Œæ§ãäžæ®µãšããããŸãã
5.4 SQLã¹ãã«ç¿åŸã®ããã®å匷æ³ãšã¢ããã€ã¹
æåŸã«ãSQLã¹ãã«ãç¿åŸããããã®å匷æ³ãšã¢ããã€ã¹ã«ã€ããŠè¿°ã¹ãŸãããŸããäžè²«ããŠåŠã¶ããšããããŠæãåãããªããåŠã¶ããšãéèŠã§ãã
ãããŠãäœããããèªåãã©ã®ããã«SQLã䜿ãããã®ããæ確ã«ããããšã倧åã§ãã
ãããã®èŠç¹ãæã€ããšã§ãããå¹æçã«SQLããã¹ã¿ãŒããããšãã§ããã§ãããã
6. SQLåŠç¿ã®èª²é¡ãšå¯Ÿç
SQLã®åŠç¿ã¯ä»»æã®ããŒã¿ããŒã¹ç®¡çãããŒã¿è§£æã®æ©èœã掻çšããäžã§äžå¯æ¬ ã§ããããããæ«æãã€ã³ãã誀解ã«å¯Ÿãã察çãéèŠãšãªãå Žé¢ããããŸãããã®ã»ã¯ã·ã§ã³ã§ã¯ãããã®èª²é¡ãšå¯Ÿçã«ã€ããŠåãäžããŸãã
6.1 é£æ床ãšæ«æãã€ã³ã
- SQLã¯æåã¯é£ããæãããããããŸããããå®çšçãªç¥èãšã¹ãã«ã®ç¿åŸã¯ãã®é£æ床ãååã«è£ããŸãã
- æ¬æ ŒçãªSQLæãæžãã®ã«ã¯äžå®ã®æ £ããå¿ èŠã§ããåããŠã³ãŒããæžããšãã¯ãç°¡åãªåœä»€ããå§ããæ £ããã次第ã«è€éãªã³ãŒãã«ç§»è¡ããŸãã
- SQLæããšã©ãŒãåºãåå ã¯ããŸããŸã§ãããããããåå ã¯ææ³ãã¹ã§ããããžãã¯ãšã©ãŒãæã èµ·ãããŸãããããã¯ããé«åºŠãªåé¡è§£æ±ºã¹ãã«ãå¿ èŠãšããŸãã
6.2 SQLåŠç¿ã«é¢ããäžè¬çãªèª€è§£
- å€ãã®äººã ã¯SQLããã¹ã¿ãŒããã«ã¯æ°åŠçãªèæ¯ãå¿ èŠã ãšèª€è§£ããŠããŸãããäºå®ã¯ããã§ã¯ãããŸãããåºæ¬çãªç®è¡ã¯å¿ èŠã§ããããã以äžã®é«åºŠãªæ°åŠçèœåã¯å¿ èŠãããŸããã
- SQLãèŠããã®ã«æéãããããšãã誀解ããããŸããç¿åŸããã®ã«ãããæéã¯åã ã®åŠç¿è ã®åæç¥èãšæéã®è²»ããæ¹ã«ããéšåã倧ããã§ãã
- SQLã¯ããã°ã©ãã³ã°èšèªã§ã¯ãªããšãã誀解ããããŸãããå®éã«ã¯ããŒã¿ãåãæ±ã匷åãªããŒã«ãšããŠã®æ§æ Œãæã€ããã°ã©ãã³ã°èšèªã§ãã
6.3 åŠç¿åæ段éã§ã®ã«ãã¬ããžãã€ã³ã
- ããŒã¿ãšãã®è¡šçŸæ¹æ³ã«ã€ããŠã®åºæ¬çãªç解ãå¿ èŠã§ããããŒã¿åã¯å€ã®çš®é¡ãç解ããäžã§äžå¿çãªåœ¹å²ãæãããŸãã
- åæ段éã§ã¯ãããŒã¿ããŒã¹ã®åºæ¬çãªæäœãããªãã¡ããŒã¿ã®ååŸãæ¿å ¥ãæŽæ°ãåé€ãè¡ããããã«ãªãããšãç®æããŸãããã
- ç°¡åãªSELECTæãæžãããšããå§ãããã®åŸWHEREå¥ãJOINãç解ã䜿çšããããšãç®æšã§ãã
6.4 åçš®åé¡è§£æ±ºã®ããã®ãªãœãŒã¹
- åé¡ã®è§£æ±ºã«ã¯ããªã³ã©ã€ã³ã®è³ªåïŒåçãµã€ããããã¥ã¡ã³ããŒã·ã§ã³ããã¥ãŒããªã¢ã«ãªã©ãäž»ã«ãŠã§ãäžã§å©çšã§ãããªãœãŒã¹ãå©çšã§ããŸãã
- SQLãåŠç¿äžã«ééãããšã©ãŒãã€ã·ã¥ãŒã«ã€ããŠã®è§£æ±ºçãã¢ããã€ã¹ãæ²èŒãããŠããããã°ãæ²ç€ºæ¿ãæçšãªæ å ±æºã§ãã
- å ·äœçãªåé¡ã解決ããããã®ã¬ã€ããèšèŒãããŠããæžç±ããå®æçã«æŽæ°ãããæè¡æ å ±ãµã€ããåèã«ãªããŸãã