{"id":414,"date":"2014-07-28T15:44:53","date_gmt":"2014-07-28T06:44:53","guid":{"rendered":"http:\/\/wp.ultimai.org\/wp\/?p=414"},"modified":"2014-07-29T05:53:26","modified_gmt":"2014-07-28T20:53:26","slug":"sql_organi","status":"publish","type":"post","link":"http:\/\/wp.ultimai.org\/?p=414","title":{"rendered":"SQL\u6587\u3092\u6700\u901f\u306b\u3059\u308b11\u306e\u30dd\u30a4\u30f3\u30c8"},"content":{"rendered":"<p>SQL\u6587\u3092\u6700\u901f\u306b\u3059\u308b11\u306e\u30dd\u30a4\u30f3\u30c8<\/p>\n<p>\u3000\u305f\u3068\u3048\u6700\u7d42\u7684\u306a\u7d50\u679c\u304c\u540c\u3058\u3067\u3082\uff0cSQL\u6587\u306f\u66f8\u304d\u65b9\u4e00\u3064\u3067\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u304c\u305a\u3044\u3076\u3093\u3068\u5909\u308f\u3063\u3066\u304d\u307e\u3059\u3002\u3053\u3053\u3067\u306f\uff0c\u901f\u3044SQL\u6587\u3092\u8a18\u8ff0\u3059\u308b\u305f\u3081\u306e\u30dd\u30a4 \u30f3\u30c8\u3084\u6ce8\u610f\u70b9\u3092\u3044\u304f\u3064\u304b\u7d39\u4ecb\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<h3>\n\u25cfWHERE\u306e\u5de6\u8fba\u3067\u7b97\u8853\u6f14\u7b97\u5b50\u3084\u95a2\u6570\u3092\u4f7f\u308f\u306a\u3044<\/h3>\n<p>  \u3000WHERE\u53e5\u306e\u5de6\u8fba\u306b\u7b97\u8853\u6f14\u7b97\u3084\u95a2\u6570\u3092\u6307\u5b9a\u3059\u308b\u3068\uff0c\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u304c\u4f7f\u308f\u308c\u307e\u305b\u3093\u3002\u4f8b\u3048\u3070\uff0c<br \/>\n  SELECT NAME FROM CUSTOMERS<br \/>\n  WHERE SAL &#8211; TAX \uff1e 1000<br \/>\n  \u3068\u3059\u308b\u3068\uff0c\u305f\u3068\u3048SAL\u30d5\u30a3\u30fc\u30eb\u30c9\u306b\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u304c\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u3066\u3082\u30c6\u30fc\u30d6\u30eb\u5168\u4f53\u3092\u8d70\u67fb\u3057\u3066\u3057\u307e\u3044\u307e\u3059\u3002\u3053\u3046\u3057\u305f\u5834\u5408\u306f\uff0c<br \/>\n  SELECT NAME FROM CUSTOMERS<br \/>\n  WHERE SAL \uff1e TAX + 1000<br \/>\n\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3059\u308c\u3070\u826f\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<h3>\u25cf\u300c\u5f8c\u65b9\u4e00\u81f4\u300d\u691c\u7d22\u306f\u306a\u308b\u3079\u304f\u907f\u3051\u308b<\/h3>\n<p>  \u3000\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u304c\u4ed8\u52a0\u3055\u308c\u3066\u3044\u308b\u30d5\u30a3\u30fc\u30eb\u30c9\u3067\u3042\u3063\u3066\u3082\uff0cLIKE &#8216;\uff05AAA&#8217; \u306e\u3088\u3046\u306a\u300c\u5f8c\u65b9\u4e00\u81f4\u300d\u3092\u6307\u5b9a\u3059\u308b\u3068\uff0c\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u691c\u7d22\u305b\u305a\u306b\u30c7\u30fc\u30bf\u90e8\u306e\u5168\u8868\u8d70\u67fb\u304c\u884c\u308f\u308c\u307e\u3059\u3002\u3057\u305f\u304c\u3063\u3066\u300c\u5f8c\u65b9\u4e00\u81f4\u300d\u306e\u4f7f\u7528\u306f\u306a\u308b\u3079\u304f\u907f\u3051\u308b\u3088\u3046\u306b\u3057\u307e \u3057\u3087\u3046\u3002\u3069\u3046\u3057\u3066\u3082\u5fc5\u8981\u3067\u3042\u308b\u306a\u3089\uff0c<br \/>\n  \u30fb\u4f55\u3089\u304b\u306e\uff0c\u5c11\u91cf\u307e\u3067\u7d5e\u308a\u8fbc\u3081\u308b\u6761\u4ef6\u3068AND\u6761\u4ef6\u3067\u7d44\u307f\u5408\u308f\u305b\u308b<br \/>\n  \u30fb\u8907\u6570\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u306b\u5206\u5272\u3057\uff0c\u5c11\u3057\u3067\u3082\u524d\u65b9\u30fb\u5b8c\u5168\u4e00\u81f4\u3067\u304d\u308b\u7bc4\u56f2\u3092\u5e83\u3052\u308b<br \/>\n\u3068\u3044\u3063\u305f\u65b9\u6cd5\u3092\u691c\u8a0e\u3057\u3066\u4e0b\u3055\u3044\u3002<\/p>\n<\/p>\n<h3>\u25cfIS NULL\uff0cIS NOT NULL\u3092\u5358\u72ec\u3067\u4f7f\u308f\u306a\u3044<\/h3>\n<p>  \u3000\u6761\u4ef6\u3092\u8868\u3059WHERE\u53e5\u306bIS NULL\/IS NOT NULL\u3092\u6307\u5b9a\u3057\u305f\u3068\u304d\u306f\uff0c\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u5b9a\u7fa9\u3057\u305f\u30d5\u30a3\u30fc\u30eb\u30c9\u3067\u3042\u3063\u3066\u3082\uff0c\u5168\u8868\u8d70\u67fb\u304c\u884c\u308f\u308c\u307e\u3059\u3002\u3057\u305f\u304c\u3063\u3066\uff0c\u3053\u308c\u3089\u306e\u6761\u4ef6\u3092\u6307\u5b9a\u3059\u308b\u3068\u304d\u306f\uff0c\u5358\u72ec\u3067\u6307\u5b9a \u3059\u308b\u306e\u3067\u306f\u306a\u304f\uff0c\u4f55\u3089\u304b\u306e\u304b\u306a\u308a\u7d5e\u308a\u8fbc\u3081\u308b\u6761\u4ef6\u3092\u5408\u308f\u305b\u3066\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u4f8b\u3048\u3070\uff0c\u554f\u3044\u5408\u308f\u305b\u306e\u7d50\u679c\u3092\u5909\u66f4\u305b\u305a\u306b\u300cB = 10\u300d\u306e\u6761\u4ef6\u3092\u4ed8\u52a0\u3067\u304d\u308b\u306a\u3089<br \/>\n  \u2026WHERE A IS NULL<br \/>\n  \u3068\u3059\u308b\u4ee3\u308f\u308a\u306b<br \/>\n  \u2026WHERE A IS NULL AND B = 10<br \/>\n\u3068\u3057\u307e\u3059\u3002<\/p>\n<\/p>\n<h3>\u25cfSELECT\u6587\u3067\u300c\uff0a\u300d\u3092\u4f7f\u308f\u306a\u3044<\/h3>\n<p>  \u3000\u30ec\u30b3\u30fc\u30c9\u9577\u304c\u9577\u3044\u3068\u304d\u3084\uff0c\u30d5\u30a3\u30fc\u30eb\u30c9\u6570\u304c\u591a\u3044\u3068\u304d\u306b\u306f\uff0c\u3059\u3079\u3066\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u8868\u3059\u300c\uff0a\u300d\u3092\u6307\u5b9a\u3059\u308b\u306e\u306f\u3067\u304d\u308b\u3060\u3051\u907f\u3051\u3066\uff0c\u4f7f\u7528\u3059\u308b\u30d5\u30a3\u30fc\u30eb\u30c9\u3060\u3051 \u3092\u6307\u5b9a\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002\u300c\uff0a\u300d\u3092\u6307\u5b9a\u3059\u308b\u3068\uff0c\u53c2\u7167\u7cfb\u306eSQL\u6587\u3067\u306f\uff0c\u3059\u3079\u3066\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u7e70\u308a\u8fd4\u3057\u3066\u30b3\u30d4\u30fc\u3059\u308b\u305f\u3081\uff0c\u30ea\u30bd\u30fc\u30b9\u3092\u7121\u99c4\u306b\u4f7f\u3046\u3053\u3068\u306b\u306a\u308a\u307e \u3059\u3002\u6700\u4f4e\u9650\u5ea6\u5fc5\u8981\u306a\u30d5\u30a3\u30fc\u30eb\u30c9\u3060\u3051\u3092\u6307\u5b9a\u3059\u308b\u306e\u304c\u57fa\u672c\u3067\u3059\u3002<\/p>\n<\/p>\n<h3>\u25cfOR\u306f\u3042\u308b\u7a0b\u5ea6\u7d5e\u308a\u8fbc\u3093\u3067\u304b\u3089\u4f7f\u3046<\/h3>\n<p>  \u3000\u8ad6\u7406\u6f14\u7b97\u5b50OR\u3092\u4f7f\u7528\u3057\u305f\u5834\u5408\uff0c\u4e00\u5fdc\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u304c\u4f7f\u7528\u3055\u308c\u308b\u3082\u306e\u306e\uff0c\u500b\u3005\u306e\u6761\u4ef6\u304c\u62bd\u51fa\u3059\u308b\u4ef6\u6570\u304c\u5c11\u306a\u3044\uff08\u6570\uff05\u7a0b\u5ea6\uff09\u72b6\u614b\u3067\u306a\u3044\u3068\uff0c\u3042\u307e\u308a\u52b9\u679c\u304c \u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<\/p>\n<h3>\u25cfGROUP BY\uff0cORDER BY\uff0cHAVING\u306f\u6ce8\u610f\u3059\u308b<\/h3>\n<p>  \u3000GROUP BY\u53e5\uff0cORDER BY\u53e5\uff0cHAVING\u53e5\u306f\uff0c\u4f59\u5206\u306a\u30c7\u30a3\u30b9\u30af\u5165\u51fa\u529b\u304c\u767a\u751f\u3057\u305f\u308a\u30c7\u30a3\u30b9\u30af\u9818\u57df\u3092\u4f7f\u3046\u306e\u3067\uff0c\u81ea\u5206\u3082\u3057\u304f\u306f\u307b\u304b\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306b\u60aa\u5f71\u97ff\u3092\u53ca\u307c\u3057\u307e \u3059\u3002\u3053\u306e\u3053\u3068\u3092\u5ff5\u982d\u306b\u304a\u3044\u3066\uff0c\u4f7f\u308f\u305a\u306b\u6e08\u3080\u306a\u3089\u306a\u308b\u3079\u304f\u4f7f\u308f\u306a\u3044\u3088\u3046\u306b\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<\/p>\n<h3>\u25cf\u6f14\u7b97\u5b50\u306e\u7d44\u307f\u5408\u308f\u305b\u3067\u901f\u5ea6\u304c\u5909\u308f\u308b<\/h3>\n<p>  \u3000\u691c\u7d22\u6761\u4ef6\u306b\uff0c\u300c\uff1e\u300d\u300c\uff1c\u300d\u300c\uff1d\u300d\u3092AND\u3067\u7d44\u307f\u5408\u308f\u305b\u308b\u3068\u304d\u306f\uff0c\u6307\u5b9a\u306e\u4ed5\u65b9\u306b\u3088\u3063\u3066\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u4f7f\u308f\u308c\u65b9\u304c\u7570\u306a\u308a\u307e\u3059\u3002\u7b49\u53f7\u3068\u4e0d\u7b49\u53f7\u306e\u7d44\u307f\u5408\u308f \u305b\u306f\uff0c\u7b49\u53f7\u306e\u307f\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u304c\u4f7f\u308f\u308c\u307e\u3059\u3002\u4f8b\u3048\u3070\uff0c<br \/>\n  SELECT NAME FROM CUSTOMERS<br \/>\n  WHERE JOB = &#8216;MANAGER&#8217;<br \/>\n  AND SAL \uff1e 1000<br \/>\n  \u3068\u3059\u308b\u3068\uff0c\u300cJOB = &#8216;MANAGER&#8217;\u300d\u306b\u306f\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u304c\u4f7f\u308f\u308c\u307e\u3059\u304c\uff0c\u300cSAL \uff1e 1000\u300d\u306b\u306f\u4f7f\u308f\u308c\u307e\u305b\u3093\u3002\u307e\u305f\uff0c\u4e0d\u7b49\u53f7\u540c\u58eb\u306e\u7d44\u307f\u5408\u308f\u305b\u3067\u306f\uff0c\u5148\u306b\u6307\u5b9a\u3057\u305f\u6761\u4ef6\u3060\u3051\u306b\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u304c\u4f7f\u308f\u308c\u307e\u3059\u3002\u3064\u307e\u308a<br \/>\n  SELECT NAME FROM CUSTOMERS<br \/>\n  WHERE TAX \uff1e 100<br \/>\n  AND SAL \uff1e 1000<br \/>\n\u306eSQL\u6587\u3067\u306f\uff0cRDBMS\u306f\u300cTAX \uff1e 100\u300d\u3060\u3051\u306b\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u4f7f\u3044\u300cSAL \uff1e 1000\u300d\u306b\u306f\u4f7f\u3044\u307e\u305b\u3093\u3002<\/p>\n<\/p>\n<h3>\u25cf\u30c6\u30fc\u30d6\u30eb\u306e\u5225\u540d\u3092\u5229\u7528\u3059\u308b<\/h3>\n<p>  \u3000\u30c6\u30fc\u30d6\u30eb\u306b\u5225\u540d\u3092\u3064\u3051\u3066\uff0c\u30d5\u30a3\u30fc\u30eb\u30c9\u540d\u306b\u306f\u305d\u306e\u5225\u540d\u3092\u3064\u3051\u308b\u3068\uff0cSQL\u6587\u306e\u89e3\u6790\u51e6\u7406\u3092\u6e1b\u3089\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4f8b\u3048\u3070\uff0c<br \/>\n  SELECT ID, NAME FROM CUSTOMERS<br \/>\n  WHERE SAL \uff1c 1000<br \/>\n  \u3088\u308a\u3082\uff0c<br \/>\n  SELECT a.ID, a.NAME FROM CUSTOMERS a<br \/>\n  WHERE SAL \uff1c 1000<br \/>\n\u306e\u307b\u3046\u304c\u9ad8\u901f\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<\/p>\n<h3>\u25cfSQL\u6587\u306e\u8868\u73fe\u3092\u7d71\u4e00\u3059\u308b<\/h3>\n<p>  \u3000\u672c\u6587\u4e2d\u3067\u8ff0\u3079\u305f\u3088\u3046\u306b\uff0cRDBMS\u306f\u5b9f\u884c\u8a08\u753b\u3092\u30ad\u30e3\u30c3\u30b7\u30e5\u306b\u4fdd\u5b58\u3057\u3066\u304a\u3044\u3066\u518d\u5229\u7528\u3057\u307e\u3059\u3002\u3068\u3053\u308d\u304c\uff0cSQL\u6587\u306b\u5b9a\u6570\u3092\u76f4\u63a5\u8a18\u8ff0\u3057\u3066\u3057\u307e\u3046 \u3068\uff0cRDBMS\u306f\u5b9a\u6570\u5024\u3060\u3051\u304c\u7570\u306a\u308bSQL\u6587\u3092\u5225\u306e\u3082\u306e\u3068\u89e3\u91c8\u3059\u308b\u305f\u3081\uff0c\u518d\u5229\u7528\u3055\u308c\u307e\u305b\u3093\uff0aB\u3002 \u30d0\u30a4\u30f3\u30c9\u5909\u6570\u3092\u4f7f\u7528\u3057\u3066\uff0c\u3067\u304d\u308b\u9650\u308aSQL\u6587\u3092\u7d71\u4e00\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002\u307e\u305f\uff0c\u6587\u5b57\u306e\u5927\u5c0f\u3084\u8a18\u8ff0\u306e\u4ed5\u65b9\u306a\u3069\u3082\u7d71\u4e00\u3057\u3066\u304a\u304b\u306a\u3044\u3068\u5225\u306eSQL\u6587\u3060\u3068\u8a8d\u8b58\u3055\u308c\u3066 \u3057\u307e\u3046\u306e\u3067\uff0c\u6c17\u3092\u4ed8\u3051\u3066\u304f\u3060\u3055\u3044\u3002\n<\/p>\n<p>\n<\/p>\n<h3>\u25cfSQL\u6587\u3092\u7c21\u6f54\u306b\u8a18\u8ff0\u3059\u308b<\/h3>\n<p>  \u3000SQL\u6587\u306f\u306a\u308b\u3079\u304f\u7c21\u6f54\u306b\u8a18\u8ff0\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002\u305d\u3046\u3059\u308b\u3053\u3068\u3067\uff0cSQL\u6587\u306e\u51e6\u7406\u6642\u9593\u3092\u77ed\u7e2e\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SQL\u6587\u3092\u6700\u901f\u306b\u3059\u308b11\u306e\u30dd\u30a4\u30f3\u30c8 \u3000\u305f\u3068\u3048\u6700\u7d42\u7684 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,14,4,15],"tags":[],"class_list":["post-414","post","type-post","status-publish","format-standard","hentry","category-access","category-database","category-mysql","category-postgresql"],"_links":{"self":[{"href":"http:\/\/wp.ultimai.org\/index.php?rest_route=\/wp\/v2\/posts\/414","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/wp.ultimai.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/wp.ultimai.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/wp.ultimai.org\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/wp.ultimai.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=414"}],"version-history":[{"count":1,"href":"http:\/\/wp.ultimai.org\/index.php?rest_route=\/wp\/v2\/posts\/414\/revisions"}],"predecessor-version":[{"id":415,"href":"http:\/\/wp.ultimai.org\/index.php?rest_route=\/wp\/v2\/posts\/414\/revisions\/415"}],"wp:attachment":[{"href":"http:\/\/wp.ultimai.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=414"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/wp.ultimai.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=414"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/wp.ultimai.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=414"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}