{"id":1660,"date":"2018-04-29T08:07:29","date_gmt":"2018-04-28T23:07:29","guid":{"rendered":"http:\/\/www.code-magagine.com\/?p=1660"},"modified":"2023-05-28T08:33:13","modified_gmt":"2023-05-27T23:33:13","slug":"%e3%80%90sql%e3%80%91%e7%b5%90%e5%90%88%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6","status":"publish","type":"post","link":"http:\/\/www.code-magagine.com\/?p=1660","title":{"rendered":"\u3010SQL\u3011\u7d50\u5408\u306b\u3064\u3044\u3066"},"content":{"rendered":"<h2>\u7d50\u5408\u3068\u306f\uff1f<\/h2>\n<p>\u6b63\u898f\u5316\u3055\u308c\u3066\u3001\u5206\u5272\u3055\u308c\u305f\u30c6\u30fc\u30d6\u30eb\u540c\u58eb\u306b\u5bfe\u3057\u3066\u3001\u7d50\u5408\u6761\u4ef6\u304c\u6e80\u305f\u3055\u308c\u305f\u884c\u30921\u884c\u305a\u3064\u3064\u306a\u3044\u3067<span style=\"color: #ff0000;\"><strong>\u4e00\u3064\u306e\u975e\u6b63\u898f\u5f62\u306e\u8868\u306b\u3059\u308b\u3053\u3068\u3002<\/strong><\/span><\/p>\n<h2>\u7d50\u5408\u306e\u52d5\u4f5c\u306e\u4ed5\u7d44\u307f<\/h2>\n<p><span style=\"color: #ff0000;\"><strong>\u7d50\u5408\u5143\u306e\u30c6\u30fc\u30d6\u30eb\u306e\u5024\u3092\u7d50\u5408\u6761\u4ef6\u306b\u3057\u3066\u30011\u884c\u305a\u3064\u7d50\u5408\u5148\u306e\u30c6\u30fc\u30d6\u30eb\u306e\u884c\u3067\u7d50\u5408\u6761\u4ef6\u306b\u5408\u3046\u3082\u306e\u304c\u306a\u3044\u304b\u63a2\u3057\u3066\u3044\u304f\u4ed5\u7d44\u307f<\/strong><\/span>\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3057\u304b\u3057\u3001\u52d5\u4f5c\u306e\u4ed5\u7d44\u307f\u7684\u306b\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306b\u69d8\u3005\u306a\u30b1\u30fc\u30b9\u304c\u8003\u3048\u3089\u308c\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n<h3>\u30b1\u30fc\u30b9\uff11\uff1a\u91cd\u8907\u304c\u3042\u3063\u305f\u5834\u5408\u306e\u7d50\u5408\u306f\uff1f<\/h3>\n<p>\u7d50\u5408\u5148\u306e\u30c6\u30fc\u30d6\u30eb\u306e\u3001\u7d50\u5408\u6761\u4ef6\u306e\u5024\u306b\u91cd\u8907\u304c\u3042\u3063\u305f\u5834\u5408\u306f\u3001<span style=\"color: #ff0000;\"><strong>\u7d50\u5408\u5143\u306e\u30c6\u30fc\u30d6\u30eb\u306e\u884c\u3092\u7d50\u5408\u5148\u306e\u91cd\u8907\u4ef6\u6570\u306b\u5408\u3046\u3088\u3046\u306b\u8907\u88fd\u3055\u308c\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/strong><\/span><\/p>\n<p>\u306a\u306e\u3067\u3001<span style=\"color: #ff0000;\"><strong>\u7d50\u5408\u7d50\u679c\u304c\u3001\u5143\u306e\u30c6\u30fc\u30d6\u30eb\u306e\u884c\u6570\u3088\u308a\u5897\u3048\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/strong><\/span><\/p>\n<h4>\u5bfe\u7b56<\/h4>\n<p>\u5bfe\u7b56\u3068\u3057\u3066\u306f\u3001\u30c6\u30fc\u30d6\u30eb\u306e\u8a2d\u8a08\u6bb5\u968e\uff08\u8ad6\u7406\u8a2d\u8a08\u6642\u306b\u8003\u3048\u308b\u3002\uff09\u3067\u3001<span style=\"color: #ff0000;\"><strong>\u300c\u591a\uff1a\u591a\u300d\u306e\u95a2\u4fc2<\/strong><\/span>\u3092\u4f5c\u3089\u306a\u3044\u3053\u3068\u3067\u3059\u3002<\/p>\n<p>\u30c6\u30fc\u30d6\u30eb\u8a2d\u8a08\u306e\u57fa\u672c\u7684\u306a\u6d41\u308c\u306b\u3064\u3044\u3066\u306f\u3001\u4e0b\u8a18\u306e\u8a18\u4e8b\u3067\u89e3\u8aac\u3057\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u3054\u89a7\u4e0b\u3055\u3044\u3002<\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"4hQNecouBp\"><p><a href=\"http:\/\/www.code-magagine.com\/?p=1447\">\u3010\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u8a2d\u8a08\u3011\u57fa\u672c\u7684\u306a\u6d41\u308c<\/a><\/p><\/blockquote>\n<p><iframe class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" src=\"http:\/\/www.code-magagine.com\/?p=1447&#038;embed=true#?secret=4hQNecouBp\" data-secret=\"4hQNecouBp\" width=\"500\" height=\"282\" title=\"&#8220;\u3010\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u8a2d\u8a08\u3011\u57fa\u672c\u7684\u306a\u6d41\u308c&#8221; &#8212; \u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30de\u30ac\u30b8\u30f3\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n<h3>\u30b1\u30fc\u30b9\uff12\uff1a\u7d50\u5408\u6761\u4ef6\u306b\u5408\u81f4\u3059\u308b\u9805\u76ee\u304c\u306a\u3044\u5834\u5408\u306f\uff1f<\/h3>\n<p>\u9006\u306b\u3001\u7d50\u5408\u5148\u306b\u7d50\u5408\u6761\u4ef6\u306b\u5408\u81f4\u3059\u308b\u9805\u76ee\u304c\u306a\u304b\u3063\u305f\u5834\u5408\u306f\u3001<span style=\"color: #ff0000;\"><strong>\u7d50\u5408\u7d50\u679c\u304c\u3001\u5143\u306e\u30c6\u30fc\u30d6\u30eb\u306e\u884c\u6570\u3088\u308a\u3082\u6e1b\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/strong><\/span><\/p>\n<h4>\u5bfe\u7b56<\/h4>\n<p>\u7d50\u5408\u7d50\u679c\u3068\u3057\u3066\u3001\u76f8\u624b\u5148\u304c\u898b\u3064\u304b\u3089\u306a\u304b\u3063\u305f\u5834\u5408\u306b\u3001\u884c\u6570\u304c\u6e1b\u3063\u3066\u3057\u307e\u3046\u306e\u306f\u554f\u984c\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p><strong>\u5bfe\u7b56\uff11\uff1a\u5916\u90e8\u7d50\u5408\u3092\u4f7f\u3046<\/strong><\/p>\n<p>\u5bfe\u7b56\u3068\u3057\u3066<span style=\"color: #ff0000;\"><strong>\u300c\u5916\u90e8\u7d50\u5408\u300d<\/strong><\/span>\u3092\u4f7f\u3046\u30d1\u30bf\u30fc\u30f3\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u300c\u5916\u90e8\u7d50\u5408\u300d\u3067\u3042\u308c\u3070\u3001<span style=\"color: #ff0000;\"><strong>\u76f8\u624b\u5148\u304c\u898b\u3064\u304b\u3089\u306a\u304b\u3063\u305f\u3068\u3057\u3066\u3082\u3001NULL\u3068\u3057\u3066\u7d50\u679c\u3092\u8fd4\u3057\u3066\u304f\u308c\u308b\u306e\u3067\u3001\u884c\u6570\u304c\u6e1b\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u305b\u3093\u3002<\/strong><\/span><\/p>\n<p><strong>\u5bfe\u7b562\uff1a\u5916\u90e8\u30ad\u30fc\u3092\u4f7f\u3046<\/strong><\/p>\n<p><span style=\"color: #ff0000;\"><strong>\u300c\u5916\u90e8\u30ad\u30fc\u300d<\/strong><\/span>\u3092\u4f7f\u3048\u3070\u3001DBMS\u304c\u30b7\u30b9\u30c6\u30e0\u7684\u306b\u3001\u89aa\u30c6\u30fc\u30d6\u30eb\u306b\u5b58\u5728\u3057\u306a\u3044\u5024\u304c\u5165\u529b\u3055\u308c\u308b\u306e\u3092\u9632\u3044\u3067\u304f\u308c\u307e\u3059\u3002<\/p>\n<p>\u305f\u3060\u3001\u5916\u90e8\u30ad\u30fc\u306b\u3082\u3001\u30e1\u30ea\u30c3\u30c8\u3001\u30c7\u30e1\u30ea\u30c3\u30c8\u3042\u308a\u307e\u3059\u306e\u3067\u3001\u4e0b\u8a18\u306e\u8a18\u4e8b\u3092\u53c2\u8003\u306b\u3055\u308c\u3066\u4e0b\u3055\u3044\u3002<\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"vbrQiyj83i\"><p><a href=\"http:\/\/www.code-magagine.com\/?p=713\">\u3010\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3011\u300c\u5916\u90e8\u30ad\u30fc\u300d\u3001\u300c\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u300d\u306b\u3064\u3044\u3066<\/a><\/p><\/blockquote>\n<p><iframe class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" src=\"http:\/\/www.code-magagine.com\/?p=713&#038;embed=true#?secret=vbrQiyj83i\" data-secret=\"vbrQiyj83i\" width=\"500\" height=\"282\" title=\"&#8220;\u3010\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3011\u300c\u5916\u90e8\u30ad\u30fc\u300d\u3001\u300c\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u300d\u306b\u3064\u3044\u3066&#8221; &#8212; \u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30de\u30ac\u30b8\u30f3\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n<h2>\u901a\u5e38\u306e\u5185\u90e8\u7d50\u5408<\/h2>\n<p>\u4e0b\u8a18\u306e\u69cb\u6587\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">SELECT \u9078\u629e\u5217\r\nFROM \u30c6\u30fc\u30d6\u30ebA\r\nJOIN \u30c6\u30fc\u30d6\u30ebB\r\nON \u7d50\u5408\u6761\u4ef6\r\n<\/pre>\n<h2>JOIN\u3092\u4f7f\u308f\u306a\u3044\u5185\u90e8\u7d50\u5408<\/h2>\n<p>RDBMS\u306b\u3088\u3063\u3066\u306f\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306bJOIN\u53e5\u3092\u4f7f\u308f\u305a\u306b\u3001\u5185\u90e8\u7d50\u5408\u3092\u8a18\u8ff0\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">SELECT \u9078\u629e\u5217\r\nFROM \u30c6\u30fc\u30d6\u30ebA,\u30c6\u30fc\u30d6\u30ebB\r\nWHERE \u7d50\u5408\u6761\u4ef6<\/pre>\n<p><span style=\"color: #ff0000;\"><strong>\u6a19\u6e96SQL\u3067\u3082\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u3066\u3001\u7279\u306b\u5e74\u914d\u30d7\u30ed\u30b0\u30e9\u30de\u304c\u66f8\u304b\u308c\u305fSQL\u6587\u3067\u306f\u672a\u3060\u306b\u3053\u3046\u3057\u305f\u8a18\u8ff0\u3092\u3055\u308c\u3066\u3044\u308b\u30b1\u30fc\u30b9\u306f\u5c11\u306a\u304f\u3042\u308a\u307e\u305b\u3093\u3002<\/strong><\/span><\/p>\n<p>\u3057\u304b\u3057\u3001\u3053\u306e\u8a18\u8ff0\u65b9\u6cd5\u306f\u3001\u4ee5\u4e0b\u7406\u7531\u306b\u3088\u308a\u3042\u307e\u308a\u63a8\u5968\u3055\u308c\u306a\u3044\u3067\u3059\u3002<\/p>\n<ul>\n<li>\u7d50\u5408\u5143\u306e\u30c6\u30fc\u30d6\u30eb\u304c\u308f\u304b\u308a\u305a\u3089\u3044\u3002<\/li>\n<li>WHERE\u53e5\u306b\u3001<span style=\"color: #ff0000;\"><strong>\u7d50\u5408\u6761\u4ef6\u3060\u3051\u3067\u306a\u304f\u3001\u7d5e\u8fbc\u307f\u6761\u4ef6\u3082\u8a18\u8ff0\u3059\u308b<\/strong><\/span>\u305f\u3081\u3001\u3069\u308c\u304c\u7d50\u5408\u6761\u4ef6\u3067\u3001\u3069\u308c\u304c\u7d5e\u308a\u8fbc\u307f\u6761\u4ef6\u306a\u306e\u304b\u5224\u5225\u304c\u3057\u305a\u3089\u3044\u3002<\/li>\n<li>\u69cb\u6587\u81ea\u4f53\u304c\u53e4\u3044\u69cb\u6587\u3068\u8a8d\u5b9a\u3055\u308c\u3064\u3064\u3042\u308b\u306e\u3067\u3001\u3044\u305a\u308c\u3053\u306e\u69cb\u6587\u304c\u4f7f\u308f\u308c\u306a\u304f\u306a\u308a\u3048\u307e\u3059\u3002<\/li>\n<\/ul>\n<p>\u7279\u306b\u53e4\u304f\u304b\u3089\u4f5c\u3089\u308c\u305f\u30b7\u30b9\u30c6\u30e0\u3067\u306f\u305d\u3046\u3067\u3059\u304c\u3001\u73fe\u5834\u3067\u3082\u826f\u304f\u898b\u304b\u3051\u308b\u5185\u90e8\u7d50\u5408\u306e\u8a18\u8ff0\u65b9\u6cd5\u306a\u306e\u3067\u3001\u65b0\u898f\u3067\u306f\u66f8\u304b\u306a\u304f\u3066\u3088\u3044\u3067\u3059\u304c\u3001<span style=\"color: #ff0000;\"><strong>\u6700\u4f4e\u9650\u77e5\u8b58\u3068\u3057\u3066\u6301\u3063\u3066\u304a\u304d\u8aad\u3081\u308b\u3088\u3046\u306b\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/strong><\/span><\/p>\n<p>\u306a\u304a\u3001WHERE\u53e5\u3092\u4f7f\u308f\u306a\u304b\u3063\u305f\u5834\u5408\u306f\u3001<span style=\"color: #ff0000;\"><strong>\u300c\u30af\u30ed\u30b9\u7d50\u5408(CROSS JOIN)\u300d<\/strong><\/span>\u3092\u3057\u305f\u7d50\u679c\u3068\u540c\u3058\u306b\u306a\u308a\u307e\u3059\u3002\u5185\u90e8\u7d50\u5408\u3092\u3057\u305f\u3044\u5834\u5408\u306f\u3001<span style=\"color: #ff0000;\"><strong>\u5fc5\u305aWHERE\u53e5\u3067\u7d50\u5408\u6761\u4ef6\u3092\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/strong><\/span><\/p>\n<h2>\u5916\u90e8\u7d50\u5408<\/h2>\n<h3>\u5de6\u5916\u90e8\u7d50\u5408<\/h3>\n<h4>\u69cb\u6587<\/h4>\n<pre class=\"lang:default decode:true\">SELECT \u9078\u629e\u5217\r\nFROM \u30c6\u30fc\u30d6\u30ebA(\u5de6\u8868\uff09\r\nLEFT JOIN \u30c6\u30fc\u30d6\u30ebB(\u53f3\u8868\uff09\r\nON \u7d50\u5408\u6761\u4ef6\r\n<\/pre>\n<h4>\u7279\u5fb4<\/h4>\n<p>\u5de6\u8868\u306e\u30c7\u30fc\u30bf\u3092\u5fc5\u305a\u6b8b\u3059\u3002<\/p>\n<h3>\u53f3\u5916\u90e8\u7d50\u5408<\/h3>\n<h4>\u69cb\u6587<\/h4>\n<pre class=\"lang:default decode:true\">SELECT \u9078\u629e\u5217\r\nFROM \u30c6\u30fc\u30d6\u30ebA(\u5de6\u8868\uff09\r\nRIGHT JOIN \u30c6\u30fc\u30d6\u30ebB(\u53f3\u8868\uff09\r\nON \u7d50\u5408\u6761\u4ef6\r\n<\/pre>\n<h4>\u7279\u5fb4<\/h4>\n<p>\u53f3\u8868\u306e\u30c7\u30fc\u30bf\u3092\u5fc5\u305a\u6b8b\u3059\u3002<\/p>\n<h3>\u300c\u5de6\u5916\u90e8\u7d50\u5408(LEFT JOIN)\u300d\u3068\u300c\u53f3\u5916\u90e8\u7d50\u5408(RIGHT JOIN)\u300d\u3092\u3069\u306e\u3088\u3046\u306b\u4f7f\u3044\u5206\u3051\u308b\u304b\uff1f<\/h3>\n<p>\u57fa\u672c\u7684\u306b\u306f\u3001<span style=\"color: #ff0000;\"><strong>\u3069\u3061\u3089\u306e\u7d50\u5408\u3082\u6a5f\u80fd\u7684\u306a\u5dee\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/strong><\/span><\/p>\n<p>\u4e00\u822c\u7684\u306b\u306f\u3001\u5148\u306b\u30de\u30b9\u30bf\u3068\u306a\u308b\u30c6\u30fc\u30d6\u30eb\u304c\u51fa\u3066\u304f\u308b<span style=\"color: #ff0000;\"><strong>\u300cLEFT JOIN\u300d<\/strong><\/span>\u3092\u4f7f\u3046\u30b1\u30fc\u30b9\u304c\u591a\u3044\u3088\u3046\u3067\u3059\u304c\u3001LEFT JOIN\u3092\u4f7f\u308f\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u3068\u3044\u3046\u660e\u78ba\u306a\u7406\u7531\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<h3>\u5b8c\u5168\u5916\u90e8\u7d50\u5408<\/h3>\n<h4>\u69cb\u6587<\/h4>\n<pre class=\"lang:default decode:true\">SELECT \u9078\u629e\u5217\r\nFROM \u30c6\u30fc\u30d6\u30ebA(\u5de6\u8868\uff09\r\nFULL JOIN \u30c6\u30fc\u30d6\u30ebB(\u53f3\u8868\uff09\r\nON \u7d50\u5408\u6761\u4ef6\r\n<\/pre>\n<h4>\u7279\u5fb4<\/h4>\n<p>\u4e21\u65b9\u306e\u8868\u30c7\u30fc\u30bf\u3092\u5fc5\u305a\u6b8b\u3059\u3002<\/p>\n<h3>\u5916\u90e8\u7d50\u5408\u306e\u4f8b<\/h3>\n<h4>\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf<\/h4>\n<h5>USER_MASTER<\/h5>\n<table style=\"border-collapse: collapse; width: 162pt;\" border=\"0\" width=\"216\" cellspacing=\"0\" cellpadding=\"0\">\n<colgroup>\n<col style=\"width: 54pt;\" span=\"3\" width=\"72\" \/> <\/colgroup>\n<tbody>\n<tr style=\"height: 13.5pt;\">\n<th style=\"height: 13.5pt; width: 54pt;\" width=\"72\" height=\"18\">USER_ID<\/th>\n<th style=\"width: 54pt;\" width=\"72\">DEPT_NO<\/th>\n<th style=\"width: 54pt;\" width=\"72\">USER_NAME<\/th>\n<\/tr>\n<tr style=\"height: 13.5pt;\">\n<td style=\"height: 13.5pt;\" align=\"right\" height=\"18\">21<\/td>\n<td align=\"right\">1002<\/td>\n<td>\u5c0f\u6cc9 \u7d14\u5b50<\/td>\n<\/tr>\n<tr style=\"height: 13.5pt;\">\n<td style=\"height: 13.5pt;\" align=\"right\" height=\"18\">22<\/td>\n<td align=\"right\">1003<\/td>\n<td>\u5c0f\u6cc9 \u4e09\u90ce<\/td>\n<\/tr>\n<tr style=\"height: 13.5pt;\">\n<td style=\"height: 13.5pt;\" align=\"right\" height=\"18\">23<\/td>\n<td align=\"right\">1004<\/td>\n<td>\u5c0f\u6cc9 \u82b1\u5b50<\/td>\n<\/tr>\n<tr style=\"height: 13.5pt;\">\n<td style=\"height: 13.5pt;\" align=\"right\" height=\"18\">20<\/td>\n<td align=\"right\">1001<\/td>\n<td>\u5c0f\u6cc9 \u7d14\u4e00<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h5>AUTHORIZATION<\/h5>\n<table style=\"border-collapse: collapse; width: 162pt;\" border=\"0\" width=\"216\" cellspacing=\"0\" cellpadding=\"0\">\n<colgroup>\n<col style=\"width: 54pt;\" span=\"3\" width=\"72\" \/> <\/colgroup>\n<tbody>\n<tr style=\"height: 13.5pt;\">\n<th style=\"height: 13.5pt; width: 54pt;\" width=\"72\" height=\"18\">USER_ID<\/th>\n<th style=\"width: 54pt;\" width=\"72\">LOGIN_ID<\/th>\n<th style=\"width: 54pt;\" width=\"72\">PASSWD<\/th>\n<\/tr>\n<tr style=\"height: 13.5pt;\">\n<td style=\"height: 13.5pt;\" align=\"right\" height=\"18\">21<\/td>\n<td align=\"right\">10002<\/td>\n<td align=\"right\">234567<\/td>\n<\/tr>\n<tr style=\"height: 13.5pt;\">\n<td style=\"height: 13.5pt;\" align=\"right\" height=\"18\">20<\/td>\n<td align=\"right\">10001<\/td>\n<td align=\"right\">1234567<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>\u5de6\u5916\u90e8\u7d50\u5408<\/h4>\n<h5>LEFT JOIN\u3092\u4f7f\u3046\u5834\u5408<\/h5>\n<pre class=\"lang:default decode:true\">SELECT * FROM USER_MASTER u\r\nLEFT JOIN AUTHORIZATION a\r\nON u.USER_ID = a.USER_ID<\/pre>\n<h5>\u5c11\u3057\u53e4\u3044\u66f8\u304d\u65b9<\/h5>\n<p>\u6761\u4ef6\u306b\u300c(+)\u300d\u3092\u4ed8\u3051\u305f\u65b9\u306e\u30c6\u30fc\u30d6\u30eb\u3092\u57fa\u6e96\u306b\u30c7\u30fc\u30bf\u3092\u6b8b\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">select * from user_master u,authorization a\r\nwhere u.USER_ID = a.USER_ID(+)<\/pre>\n<h5>\u5b9f\u884c\u7d50\u679c<\/h5>\n<table style=\"border-collapse: collapse; width: 324pt;\" border=\"0\" width=\"432\" cellspacing=\"0\" cellpadding=\"0\">\n<colgroup>\n<col style=\"width: 54pt;\" span=\"6\" width=\"72\" \/> <\/colgroup>\n<tbody>\n<tr style=\"height: 13.5pt;\">\n<td style=\"height: 13.5pt; width: 54pt;\" width=\"72\" height=\"18\">USER_ID<\/td>\n<td style=\"width: 54pt;\" width=\"72\">DEPT_NO<\/td>\n<td style=\"width: 54pt;\" width=\"72\">USER_NAME<\/td>\n<td style=\"width: 54pt;\" width=\"72\">USER_ID<\/td>\n<td style=\"width: 54pt;\" width=\"72\">LOGIN_ID<\/td>\n<td style=\"width: 54pt;\" width=\"72\">PASSWD<\/td>\n<\/tr>\n<tr style=\"height: 13.5pt;\">\n<td style=\"height: 13.5pt;\" align=\"right\" height=\"18\">21<\/td>\n<td align=\"right\">1002<\/td>\n<td>\u5c0f\u6cc9 \u7d14\u5b50<\/td>\n<td align=\"right\">21<\/td>\n<td align=\"right\">10002<\/td>\n<td align=\"right\">234567<\/td>\n<\/tr>\n<tr style=\"height: 13.5pt;\">\n<td style=\"height: 13.5pt;\" align=\"right\" height=\"18\">20<\/td>\n<td align=\"right\">1001<\/td>\n<td>\u5c0f\u6cc9 \u7d14\u4e00<\/td>\n<td align=\"right\">20<\/td>\n<td align=\"right\">10001<\/td>\n<td align=\"right\">1234567<\/td>\n<\/tr>\n<tr style=\"height: 13.5pt;\">\n<td style=\"height: 13.5pt;\" align=\"right\" height=\"18\">23<\/td>\n<td align=\"right\">1004<\/td>\n<td>\u5c0f\u6cc9 \u82b1\u5b50<\/td>\n<td>NULL<\/td>\n<td>NULL<\/td>\n<td>NULL<\/td>\n<\/tr>\n<tr style=\"height: 13.5pt;\">\n<td style=\"height: 13.5pt;\" align=\"right\" height=\"18\">22<\/td>\n<td align=\"right\">1003<\/td>\n<td>\u5c0f\u6cc9 \u4e09\u90ce<\/td>\n<td>NULL<\/td>\n<td>NULL<\/td>\n<td>NULL<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>LEFT JOIN\u6c7a\u3081\u6253\u3061\u30eb\u30fc\u30eb\u306b\u3064\u3044\u3066<\/h3>\n<p>LEFT JOIN\u306bON\u53e5\u3092\u4f7f\u3063\u3066\u62bd\u51fa\u3092\u3059\u308c\u3070INNER JOIN\u3068\u540c\u3058\u3088\u3046\u306b\u4f7f\u3046\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002\u306a\u306e\u3067\u3001\u958b\u767a\u73fe\u5834\u306b\u3088\u3063\u3066\u306f\u300cLEFT JOIN\u306e\u307f\u3092\u4f7f\u3046\u3053\u3068\u300d\u3068\u30eb\u30fc\u30eb\u3092\u6c7a\u3081\u3066\u3044\u308b\u73fe\u5834\u3082\u3042\u308b\u3088\u3046\u3067\u3059\u3002<\/p>\n<p>\u305f\u3060\u3001\u3053\u308c\u306f\u4ee5\u4e0b\u306e\u7406\u7531\u306b\u3088\u308a\u3042\u307e\u308a\u826f\u304f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<h3>NULL\u304c\u5165\u308b<\/h3>\n<p>\u306a\u305c\u306a\u3089LEFT JOIN\u306f\u30ab\u30e9\u30e0\u306bNULL\u304c\u5165\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u305f\u3081\u3067\u3059\u3002\u30ab\u30e9\u30e0\u306bNULL\u304c\u5165\u308b\u3068\u5fc5\u7136\u7684\u306b\u601d\u308f\u306c\u30d0\u30b0\u304c\u767a\u751f\u3059\u308b\u53ef\u80fd\u6027\u304c\u4e0a\u304c\u308a\u307e\u3059\u3002<\/p>\n<h3>\u7121\u610f\u5473\u306aWHERE\u53e5\u64cd\u4f5c\u304c\u5165\u308b\u5834\u5408\u304c\u3042\u308b\u3002<\/h3>\n<p>\u305d\u3082\u305d\u3082\u3001INNER JOIN\u3092\u4f7f\u3063\u3066\u3044\u308c\u3070LEFT JOIN\u3057\u3066\u304b\u3089\u306e\u3061\u306b\u6761\u4ef6\u3092\u62bd\u51fa\u3059\u308b\u3068\u3044\u3046\u64cd\u4f5c\u306f\u4e0d\u8981\u306b\u306a\u308b\u5834\u5408\u304c\u591a\u3044\u3067\u3059\u3002\u7121\u610f\u5473\u306a\u64cd\u4f5c\u3092\u3057\u3044\u3089\u308c\u308b\u3053\u3068\u306b\u306a\u308a\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306b\u5f71\u97ff\u304c\u51fa\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n<h2>\u30af\u30ed\u30b9\u7d50\u5408(CROSS JOIN)<\/h2>\n<p>\u3053\u306e\u7d50\u5408\u306f\u3001\u7d50\u8ad6\u304b\u3089\u7533\u3057\u307e\u3059\u3068\u3001<span style=\"color: #ff0000;\"><strong>\u5b9f\u52d9\u3067\u6271\u3046\u3053\u3068\u306f\u307b\u307c\u306a\u3044<\/strong><\/span>\u3067\u3059\u3002<\/p>\n<p>\u96c6\u5408\u3067\u8a00\u3048\u3070\u3001\u300c\u76f4\u7a4d\u300d\u306b\u306a\u308b\u306e\u3067\u3001\u5927\u91cf\u306e\u884c\u6570\u304c\u51fa\u3066\u304d\u307e\u3059\u3002<\/p>\n<h2>\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u610f\u8b58\u3057\u305f\u7d50\u5408<\/h2>\n<p>\u5c11\u3057\u3001SQL\u4e0a\u7d1a\u8005\u5411\u3051\u306b\u306a\u308a\u307e\u3059\u304c\u3001\u7d50\u5408\u51e6\u7406\u306f\u975e\u5e38\u306b\u8ca0\u8377\u304c\u304b\u304b\u308b\u51e6\u7406\u3067\u3059\u3002<\/p>\n<p>\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u610f\u8b58\u3057\u305f\u7d50\u5408\u306b\u3064\u3044\u3066\u3082\u8003\u616e\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u3087\u3046\u3002\u8a73\u3057\u304f\u306f\u3001\u4e0b\u8a18\u306e\u8a18\u4e8b\u3067\u89e3\u8aac\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"ugEbdyHDbU\"><p><a href=\"http:\/\/www.code-magagine.com\/?p=2406\">\u3010SQL\u3011\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u8003\u3048\u308b\u306b\u5f53\u305f\u308a\u5fc5\u8981\u306a\u300c\u7d50\u5408\u300d\u306e\u77e5\u8b58(Oracle)<\/a><\/p><\/blockquote>\n<p><iframe class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" src=\"http:\/\/www.code-magagine.com\/?p=2406&#038;embed=true#?secret=ugEbdyHDbU\" data-secret=\"ugEbdyHDbU\" width=\"500\" height=\"282\" title=\"&#8220;\u3010SQL\u3011\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u8003\u3048\u308b\u306b\u5f53\u305f\u308a\u5fc5\u8981\u306a\u300c\u7d50\u5408\u300d\u306e\u77e5\u8b58(Oracle)&#8221; &#8212; \u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30de\u30ac\u30b8\u30f3\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"\u7d50\u5408\u3068\u306f\uff1f \u6b63\u898f\u5316\u3055\u308c\u3066\u3001\u5206\u5272\u3055\u308c\u305f\u30c6\u30fc\u30d6\u30eb\u540c\u58eb\u306b\u5bfe\u3057\u3066\u3001\u7d50\u5408\u6761\u4ef6\u304c\u6e80\u305f\u3055\u308c\u305f\u884c\u30921\u884c\u305a\u3064\u3064\u306a\u3044\u3067\u4e00\u3064\u306e\u975e\u6b63\u898f\u5f62\u306e\u8868\u306b\u3059\u308b\u3053\u3068\u3002 \u7d50\u5408\u306e\u52d5\u4f5c\u306e\u4ed5\u7d44\u307f \u7d50\u5408\u5143\u306e\u30c6\u30fc\u30d6\u30eb\u306e\u5024\u3092\u7d50\u5408\u6761\u4ef6\u306b\u3057\u3066\u30011\u884c\u305a\u3064\u7d50\u5408\u5148\u306e\u30c6\u30fc\u30d6\u30eb\u306e\u884c\u3067\u7d50 [&hellip;]","protected":false},"author":1,"featured_media":2019,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[24,14],"tags":[],"_links":{"self":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/1660"}],"collection":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1660"}],"version-history":[{"count":29,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/1660\/revisions"}],"predecessor-version":[{"id":20763,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/1660\/revisions\/20763"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/media\/2019"}],"wp:attachment":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1660"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1660"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1660"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}