{"id":15949,"date":"2024-07-22T21:26:37","date_gmt":"2024-07-22T17:56:37","guid":{"rendered":"https:\/\/www.itpiran.net\/blog\/?p=15949"},"modified":"2024-08-14T20:32:31","modified_gmt":"2024-08-14T17:02:31","slug":"how-to-use-joins-in-sql","status":"publish","type":"post","link":"https:\/\/www.itpiran.net\/blog\/ja\/tutorials\/how-to-use-joins-in-sql\/","title":{"rendered":"SQL\u3067\u7d50\u5408\u3092\u4f7f\u7528\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"<h2 id=\"%d9%85%d9%82%d8%af%d9%85%d9%87\">\u5c0e\u5165<\/h2>\n<p>\u591a\u304f\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u8a2d\u8a08\u3067\u306f\u3001\u7279\u5b9a\u306e\u30c7\u30fc\u30bf\u30dd\u30a4\u30f3\u30c8\u9593\u306e\u95a2\u4fc2\u6027\u306b\u57fa\u3065\u3044\u3066\u60c5\u5831\u3092\u8907\u6570\u306e\u30c6\u30fc\u30d6\u30eb\u306b\u5206\u5272\u3057\u307e\u3059\u3002\u3053\u306e\u3088\u3046\u306a\u5834\u5408\u3067\u3082\u3001\u8907\u6570\u306e\u30c6\u30fc\u30d6\u30eb\u304b\u3089\u4e00\u5ea6\u306b\u60c5\u5831\u3092\u53d6\u5f97\u3057\u305f\u3044\u5834\u5408\u304c\u3042\u308b\u3067\u3057\u3087\u3046\u3002.<\/p>\n<p>\u69cb\u9020\u5316\u7167\u4f1a\u8a00\u8a9e (SQL) \u64cd\u4f5c\u3067\u8907\u6570\u306e\u30c6\u30fc\u30d6\u30eb\u306e\u30c7\u30fc\u30bf\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u4e00\u822c\u7684\u306a\u65b9\u6cd5\u306f\u3001JOIN \u53e5\u3092\u4f7f\u3063\u3066\u30c6\u30fc\u30d6\u30eb\u3092\u7d50\u5408\u3059\u308b\u3053\u3068\u3067\u3059\u3002\u30ea\u30ec\u30fc\u30b7\u30e7\u30ca\u30eb\u4ee3\u6570\u306e\u7d50\u5408\u64cd\u4f5c\u306b\u57fa\u3065\u3044\u3066\u3001JOIN \u53e5\u306f\u5404\u30c6\u30fc\u30d6\u30eb\u5185\u306e\u4e92\u3044\u306b\u95a2\u9023\u3059\u308b\u884c\u3092\u4e00\u81f4\u3055\u305b\u308b\u3053\u3068\u3067\u3001\u5225\u3005\u306e\u30c6\u30fc\u30d6\u30eb\u3092\u7d50\u5408\u3057\u307e\u3059\u3002\u901a\u5e38\u3001\u3053\u306e\u95a2\u4fc2\u306f\u3001\u3042\u308b\u30c6\u30fc\u30d6\u30eb\u306e\u5916\u90e8\u30ad\u30fc\u3068\u3001\u305d\u306e\u5916\u90e8\u30ad\u30fc\u304c\u53c2\u7167\u3059\u308b\u5225\u306e\u30c6\u30fc\u30d6\u30eb\u306e\u4e3b\u30ad\u30fc\u306a\u3069\u3001\u5024\u3092\u5171\u6709\u3059\u308b2\u3064\u306e\u5217\uff08\u5404\u30c6\u30fc\u30d6\u30eb\u304b\u30891\u3064\uff09\u306b\u57fa\u3065\u3044\u3066\u3044\u307e\u3059\u3002.<\/p>\n<p>\u3053\u306e\u30ac\u30a4\u30c9\u3067\u306f\u3001JOIN\u53e5\u3092\u542b\u3080\u69d8\u3005\u306aSQL\u30af\u30a8\u30ea\u306e\u69cb\u7bc9\u65b9\u6cd5\u3092\u8aac\u660e\u3057\u307e\u3059\u3002\u307e\u305f\u3001JOIN\u53e5\u306e\u7a2e\u985e\u3001\u8907\u6570\u306e\u30c6\u30fc\u30d6\u30eb\u304b\u3089\u30c7\u30fc\u30bf\u3092\u7d50\u5408\u3059\u308b\u65b9\u6cd5\u3001\u305d\u3057\u3066JOIN\u64cd\u4f5c\u306e\u8a18\u8ff0\u3092\u7c21\u7d20\u5316\u3059\u308b\u305f\u3081\u306e\u5217\u306e\u30a8\u30a4\u30ea\u30a2\u30b9\u8a2d\u5b9a\u65b9\u6cd5\u306b\u3064\u3044\u3066\u3082\u8aac\u660e\u3057\u307e\u3059\u3002.<\/p>\n<h5 id=\"%d9%be%db%8c%d8%b4-%d9%86%db%8c%d8%a7%d8%b2%d9%87%d8%a7\">\u524d\u63d0\u6761\u4ef6<\/h5>\n<p>\u3053\u306e\u30ac\u30a4\u30c9\u306b\u5f93\u3046\u306b\u306f\u3001SQL\u3092\u4f7f\u7528\u3059\u308b\u30ea\u30ec\u30fc\u30b7\u30e7\u30ca\u30eb\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u7ba1\u7406\u30b7\u30b9\u30c6\u30e0\uff08RDBMS\uff09\u3092\u642d\u8f09\u3057\u305f\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u30fc\u304c\u5fc5\u8981\u3067\u3059\u3002\u3053\u306e\u30ac\u30a4\u30c9\u306e\u624b\u9806\u3068\u4f8b\u306f\u3001\u4ee5\u4e0b\u306e\u74b0\u5883\u3067\u691c\u8a3c\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<ul>\n<li>Ubuntu 20.04 \u3092\u5b9f\u884c\u3057\u3066\u3044\u308b\u30b5\u30fc\u30d0\u30fc\u3001\u7ba1\u7406\u8005\u6a29\u9650\u3092\u6301\u3064\u975e\u30eb\u30fc\u30c8\u30e6\u30fc\u30b6\u30fc\u3001\u304a\u3088\u3073 UFW \u3067\u69cb\u6210\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30a2\u30a6\u30a9\u30fc\u30eb<\/li>\n<li>MySQL \u306f\u30b5\u30fc\u30d0\u30fc\u4e0a\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3001\u4fdd\u8b77\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/li>\n<li>\u307e\u305f\u3001JOIN\u64cd\u4f5c\u306e\u7df4\u7fd2\u306b\u4f7f\u7528\u3067\u304d\u308b\u30b5\u30f3\u30d7\u30eb\u30c7\u30fc\u30bf\u304c\u30ed\u30fc\u30c9\u3055\u308c\u305f\u30c6\u30fc\u30d6\u30eb\u304c\u3044\u304f\u3064\u304b\u3042\u308b\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3082\u5fc5\u8981\u3067\u3059\u3002MySQL\u30b5\u30fc\u30d0\u30fc\u3078\u306e\u63a5\u7d9a\u65b9\u6cd5\u3068\u3001\u3053\u306e\u30ac\u30a4\u30c9\u306e\u4f8b\u3067\u4f7f\u7528\u3059\u308b\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u4f5c\u6210\u65b9\u6cd5\u306b\u3064\u3044\u3066\u306f\u3001\u4ee5\u4e0b\u306e\u300cMySQL\u3078\u306e\u63a5\u7d9a\u3068\u30b5\u30f3\u30d7\u30eb\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u8a2d\u5b9a\u300d\u30bb\u30af\u30b7\u30e7\u30f3\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002.<\/li>\n<\/ul>\n<h5 id=\"%d8%a7%d8%aa%d8%b5%d8%a7%d9%84-%d8%a8%d9%87-mysql-%d9%88-%d8%b1%d8%a7%d9%87-%d8%a7%d9%86%d8%af%d8%a7%d8%b2%db%8c-%db%8c%da%a9-%d9%be%d8%a7%db%8c%da%af%d8%a7%d9%87-%d8%af%d8%a7%d8%af%d9%87-%d9%86%d9%85\">MySQL\u3078\u306e\u63a5\u7d9a\u3068\u30b5\u30f3\u30d7\u30eb\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u8a2d\u5b9a<\/h5>\n<p>SQL \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9 \u30b7\u30b9\u30c6\u30e0\u304c\u30ea\u30e2\u30fc\u30c8 \u30b5\u30fc\u30d0\u30fc\u4e0a\u3067\u5b9f\u884c\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u306f\u3001\u30ed\u30fc\u30ab\u30eb \u30de\u30b7\u30f3\u304b\u3089\u30b5\u30fc\u30d0\u30fc\u306b SSH \u3067\u63a5\u7d9a\u3057\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>ssh sammy@your_server_ip\r\n<\/code><\/pre>\n<\/div>\n<p>\u6b21\u306b\u3001MySQL \u30b5\u30fc\u30d0\u30fc \u30d7\u30ed\u30f3\u30d7\u30c8\u3092\u958b\u304d\u3001Sami \u3092 MySQL \u30e6\u30fc\u30b6\u30fc\u540d\u306b\u7f6e\u304d\u63db\u3048\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-sql\" data-lang=\"SQL\"><code>mysql -u sammy -p\r\n<\/code><\/pre>\n<\/div>\n<p>joinsDB \u3068\u3044\u3046\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-sql\" data-lang=\"SQL\"><code>CREATE DATABASE joinsDB;\r\n<\/code><\/pre>\n<\/div>\n<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304c\u6b63\u5e38\u306b\u4f5c\u6210\u3055\u308c\u308b\u3068\u3001\u6b21\u306e\u51fa\u529b\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code>Output\r\nQuery OK, 1 row affected (0.01 sec)<\/code><\/pre>\n<\/div>\n<p>joinsDB \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u9078\u629e\u3059\u308b\u306b\u306f\u3001\u6b21\u306e USE \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-sql\" data-lang=\"SQL\"><code>USE joinsDB;<\/code><\/pre>\n<\/div>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code>Output\r\nDatabase changed<\/code><\/pre>\n<\/div>\n<p>joinsDB \u3092\u9078\u629e\u3057\u305f\u3089\u3001\u305d\u306e\u4e2d\u306b\u3044\u304f\u3064\u304b\u306e\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u3053\u306e\u30ac\u30a4\u30c9\u306e\u4f8b\u3067\u306f\u3001\u5de5\u5834\u3092\u7d4c\u55b6\u3057\u3066\u3044\u3066\u3001\u751f\u7523\u30e9\u30a4\u30f3\u3001\u55b6\u696d\u30c1\u30fc\u30e0\u306e\u5f93\u696d\u54e1\u3001\u305d\u3057\u3066\u4f1a\u793e\u306e\u58f2\u4e0a\u306b\u95a2\u3059\u308b\u60c5\u5831\u3092 SQL \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3067\u8ffd\u8de1\u3059\u308b\u3053\u3068\u306b\u3057\u305f\u3068\u3057\u307e\u3059\u3002\u307e\u305a 3 \u3064\u306e\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u6700\u521d\u306e\u30c6\u30fc\u30d6\u30eb\u306b\u306f\u88fd\u54c1\u306b\u95a2\u3059\u308b\u60c5\u5831\u3092\u4fdd\u5b58\u3057\u307e\u3059\u3002\u3053\u306e\u6700\u521d\u306e\u30c6\u30fc\u30d6\u30eb\u306b\u306f 3 \u3064\u306e\u5217\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<ul>\n<li>\u5546\u54c1ID: int\u30c7\u30fc\u30bf\u578b\u3067\u8868\u3055\u308c\u308b\u5404\u5546\u54c1\u306e\u8b58\u5225\u756a\u53f7\u3002\u3053\u306e\u5217\u306f\u30c6\u30fc\u30d6\u30eb\u306e\u4e3b\u30ad\u30fc\u3068\u3057\u3066\u6a5f\u80fd\u3057\u3001\u5404\u5024\u306f\u5bfe\u5fdc\u3059\u308b\u884c\u306e\u4e00\u610f\u306e\u8b58\u5225\u5b50\u3068\u3057\u3066\u6a5f\u80fd\u3057\u307e\u3059\u3002\u4e3b\u30ad\u30fc\u306e\u5404\u5024\u306f\u4e00\u610f\u3067\u3042\u308b\u5fc5\u8981\u304c\u3042\u308b\u305f\u3081\u3001\u3053\u306e\u5217\u306b\u306fUNIQUE\u5236\u7d04\u3082\u9069\u7528\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/li>\n<li>productName: \u5404\u88fd\u54c1\u306e\u540d\u524d\u306f\u3001\u6700\u5927 20 \u6587\u5b57\u306e varchar \u30c7\u30fc\u30bf\u578b\u3092\u4f7f\u7528\u3057\u3066\u8868\u73fe\u3055\u308c\u307e\u3059\u3002.<\/li>\n<li>\u4fa1\u683c: \u5404\u5546\u54c1\u306e\u4fa1\u683c\u3002\u5c0f\u6570\u70b9\u4ee5\u4e0b\u306e\u6570\u5024\u3067\u8868\u3055\u308c\u307e\u3059\u3002\u3053\u306e\u5217\u306e\u5024\u306f\u6700\u59274\u6841\u306b\u5236\u9650\u3055\u308c\u3001\u305d\u306e\u3046\u30612\u6841\u306f\u5c0f\u6570\u70b9\u4ee5\u4e0b\u3068\u306a\u308a\u307e\u3059\u3002\u3057\u305f\u304c\u3063\u3066\u3001\u3053\u306e\u5217\u3067\u8a31\u5bb9\u3055\u308c\u308b\u5024\u306e\u7bc4\u56f2\u306f-99.99\uff5e99.99\u3067\u3059\u3002<\/li>\n<\/ul>\n<p>\u6b21\u306e 3 \u3064\u306e\u5217\u3092\u6301\u3064\u3001products \u3068\u3044\u3046\u540d\u524d\u306e\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-sql\" data-lang=\"SQL\"><code>CREATE TABLE products (\r\nproductID int UNIQUE,\r\nproductName varchar(20),\r\nprice decimal (4,2),\r\nPRIMARY KEY (productID)\r\n);<\/code><\/pre>\n<\/div>\n<p>2\u3064\u76ee\u306e\u30c6\u30fc\u30d6\u30eb\u306b\u306f\u3001\u4f1a\u793e\u306e\u55b6\u696d\u30c1\u30fc\u30e0\u306e\u5f93\u696d\u54e1\u306b\u95a2\u3059\u308b\u60c5\u5831\u304c\u683c\u7d0d\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u3053\u306e\u30c6\u30fc\u30d6\u30eb\u306b\u3082\u3001\u4ee5\u4e0b\u306e3\u3064\u306e\u5217\u304c\u5fc5\u8981\u3067\u3042\u308b\u3068\u5224\u65ad\u3057\u307e\u3057\u305f\u3002<\/p>\n<ul>\n<li>empID: productID\u5217\u3068\u540c\u69d8\u306b\u3001\u3053\u306e\u5217\u306b\u306f\u55b6\u696d\u30c1\u30fc\u30e0\u306e\u5404\u5f93\u696d\u54e1\u306e\u4e00\u610f\u306eID\u756a\u53f7\u304cint\u578b\u3067\u683c\u7d0d\u3055\u308c\u307e\u3059\u3002\u305d\u306e\u305f\u3081\u3001\u3053\u306e\u5217\u306b\u306fUNIQUE\u5236\u7d04\u304c\u8a2d\u5b9a\u3055\u308c\u3001team\u30c6\u30fc\u30d6\u30eb\u306e\u4e3b\u30ad\u30fc\u3068\u3057\u3066\u6a5f\u80fd\u3057\u307e\u3059\u3002.<\/li>\n<li>empName: \u6700\u5927 20 \u6587\u5b57\u306e varchar \u30c7\u30fc\u30bf\u578b\u3092\u4f7f\u7528\u3057\u3066\u8868\u3055\u308c\u308b\u5404\u55b6\u696d\u62c5\u5f53\u8005\u306e\u540d\u524d\u3002.<\/li>\n<li>productSpecialty: \u55b6\u696d\u30c1\u30fc\u30e0\u306e\u5404\u30e1\u30f3\u30d0\u30fc\u306b\u306f\u3001\u5c02\u9580\u5206\u91ce\u3068\u3057\u3066\u88fd\u54c1\u304c\u5272\u308a\u5f53\u3066\u3089\u308c\u3066\u3044\u307e\u3059\u3002\u5404\u30e1\u30f3\u30d0\u30fc\u306f\u4f1a\u793e\u304c\u88fd\u9020\u3059\u308b\u3042\u3089\u3086\u308b\u88fd\u54c1\u3092\u8ca9\u58f2\u3067\u304d\u307e\u3059\u304c\u3001\u5168\u4f53\u7684\u306a\u7126\u70b9\u306f\u81ea\u5206\u304c\u5c02\u9580\u3068\u3059\u308b\u88fd\u54c1\u306b\u7f6e\u304b\u308c\u307e\u3059\u3002\u3053\u308c\u3092\u30c6\u30fc\u30d6\u30eb\u3067\u8868\u73fe\u3059\u308b\u305f\u3081\u306b\u3001\u5404\u5f93\u696d\u54e1\u304c\u5c02\u9580\u3068\u3059\u308b\u88fd\u54c1\u306eproductID\u5024\u3092\u4fdd\u6301\u3059\u308b\u5217\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002.<\/li>\n<\/ul>\n<p>productSpecialty\u5217\u306b\u6709\u52b9\u306a\u88fd\u54c1ID\u756a\u53f7\u3092\u8868\u3059\u5024\u306e\u307f\u304c\u542b\u307e\u308c\u308b\u3088\u3046\u306b\u3059\u308b\u305f\u3081\u306b\u3001Products\u30c6\u30fc\u30d6\u30eb\u306eproductID\u5217\u3092\u53c2\u7167\u3059\u308b\u5217\u306b\u5916\u90e8\u30ad\u30fc\u5236\u7d04\u3092\u9069\u7528\u3059\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002\u5916\u90e8\u30ad\u30fc\u5236\u7d04\u306f\u3001\u9069\u7528\u5148\u306e\u5217\u306e\u5024\u304c\u53c2\u7167\u5148\u306e\u5217\u306b\u3082\u5fc5\u305a\u5b58\u5728\u3059\u308b\u3053\u3068\u3092\u6761\u4ef6\u3068\u3059\u308b\u3053\u3068\u3067\u30012\u3064\u306e\u30c6\u30fc\u30d6\u30eb\u9593\u306e\u95a2\u4fc2\u3092\u8868\u73fe\u3059\u308b\u65b9\u6cd5\u3067\u3059\u3002\u6b21\u306eCREATE TABLE\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u3067\u306f\u3001FOREIGN KEY\u5236\u7d04\u306b\u3088\u308a\u3001team\u30c6\u30fc\u30d6\u30eb\u306eproductSpecialty\u5217\u306b\u8ffd\u52a0\u3055\u308c\u308b\u5024\u306f\u3001Products\u30c6\u30fc\u30d6\u30eb\u306eproductID\u5217\u306b\u3082\u5fc5\u305a\u5b58\u5728\u3059\u308b\u3053\u3068\u304c\u6761\u4ef6\u3068\u306a\u308a\u307e\u3059\u3002.<\/p>\n<p>\u6b21\u306e 3 \u3064\u306e\u5217\u3092\u6301\u3064 Team \u3068\u3044\u3046\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-sql\" data-lang=\"SQL\"><code>CREATE TABLE team (\r\nempID int UNIQUE,\r\nempName varchar(20),\r\nproductSpecialty int,\r\nPRIMARY KEY (empID),\r\nFOREIGN KEY (productSpecialty) REFERENCES products (productID)\r\n);\r\n<\/code><\/pre>\n<\/div>\n<p>\u6700\u5f8c\u306b\u4f5c\u6210\u3059\u308b\u30c6\u30fc\u30d6\u30eb\u306b\u306f\u3001\u4f1a\u793e\u306e\u58f2\u4e0a\u8a18\u9332\u304c\u683c\u7d0d\u3055\u308c\u307e\u3059\u3002\u3053\u306e\u30c6\u30fc\u30d6\u30eb\u306b\u306f4\u3064\u306e\u5217\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<ul>\n<li>saleID: productID\u5217\u304a\u3088\u3073empID\u5217\u3068\u540c\u69d8\u306b\u3001\u3053\u306e\u5217\u306b\u306f\u5404\u58f2\u4e0a\u306e\u4e00\u610f\u306e\u8b58\u5225\u756a\u53f7\u304cint\u578b\u3067\u683c\u7d0d\u3055\u308c\u307e\u3059\u3002\u307e\u305f\u3001\u3053\u306e\u5217\u306b\u306fUNIQUE\u5236\u7d04\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3001sales\u30c6\u30fc\u30d6\u30eb\u306e\u4e3b\u30ad\u30fc\u3068\u3057\u3066\u6a5f\u80fd\u3057\u307e\u3059\u3002<\/li>\n<li>\u6570\u91cf: \u5404\u5546\u54c1\u306e\u8ca9\u58f2\u500b\u6570\u3092 int \u30c7\u30fc\u30bf\u578b\u3067\u8868\u3057\u307e\u3059\u3002<\/li>\n<li>\u88fd\u54c1 ID: \u8ca9\u58f2\u3055\u308c\u305f\u88fd\u54c1\u306e\u8b58\u5225\u756a\u53f7 (int \u3068\u3057\u3066\u8868\u73fe)\u3002<\/li>\n<li>\u8ca9\u58f2\u54e1: \u8ca9\u58f2\u3092\u884c\u3063\u305f\u5f93\u696d\u54e1\u306e\u8b58\u5225\u756a\u53f7\u3002<\/li>\n<\/ul>\n<p>team\u30c6\u30fc\u30d6\u30eb\u306eproductSpecialty\u5217\u3068\u540c\u69d8\u306b\u3001productID\u5217\u3068salesperson\u5217\u306e\u4e21\u65b9\u306bFOREIGN KEY\u5236\u7d04\u3092\u9069\u7528\u3059\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u3053\u308c\u3089\u306e\u5217\u306b\u306f\u3001\u305d\u308c\u305e\u308cproducts\u30c6\u30fc\u30d6\u30eb\u306eproductID\u5217\u3068team\u30c6\u30fc\u30d6\u30eb\u306eempID\u5217\u306b\u5b58\u5728\u3059\u308b\u5024\u306e\u307f\u304c\u542b\u307e\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002.<\/p>\n<p>\u6b21\u306e 4 \u3064\u306e\u5217\u3092\u6301\u3064 Sales \u3068\u3044\u3046\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-sql\" data-lang=\"SQL\"><code>CREATE TABLE sales (\r\nsaleID int UNIQUE,\r\nquantity int,\r\nproductID int,\r\nsalesperson int,\r\nPRIMARY KEY (saleID),\r\nFOREIGN KEY (productID) REFERENCES products (productID),\r\nFOREIGN KEY (salesperson) REFERENCES team (empID)\r\n);<\/code><\/pre>\n<\/div>\n<p>\u6b21\u306b\u3001\u6b21\u306e INSERT INTO \u64cd\u4f5c\u3092\u5b9f\u884c\u3057\u3066\u3001\u30b5\u30f3\u30d7\u30eb \u30c7\u30fc\u30bf\u3092 Products \u30c6\u30fc\u30d6\u30eb\u306b\u30ed\u30fc\u30c9\u3057\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-sql\" data-lang=\"SQL\"><code>INSERT INTO products\r\nVALUES\r\n(1, 'widget', 18.99),\r\n(2, 'gizmo', 14.49),\r\n(3, 'thingamajig', 39.99),\r\n(4, 'doodad', 11.50),\r\n(5, 'whatzit', 29.99);<\/code><\/pre>\n<\/div>\n<p>\u6b21\u306b\u3001\u30b5\u30f3\u30d7\u30eb \u30c7\u30fc\u30bf\u3092\u542b\u3080\u30c1\u30fc\u30e0 \u30c6\u30fc\u30d6\u30eb\u3092\u30ed\u30fc\u30c9\u3057\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-sql\" data-lang=\"SQL\"><code>INSERT INTO team\r\nVALUES\r\n(1, 'Florence', 1),\r\n(2, 'Mary', 4),\r\n(3, 'Diana', 3),\r\n(4, 'Betty', 2);<\/code><\/pre>\n<\/div>\n<p>\u30b5\u30f3\u30d7\u30eb\u30c7\u30fc\u30bf\u3092\u542b\u3080 sales \u30c6\u30fc\u30d6\u30eb\u3082\u30ed\u30fc\u30c9\u3057\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-sql\" data-lang=\"SQL\"><code>INSERT INTO sales\r\nVALUES\r\n(1, 7, 1, 1),\r\n(2, 10, 5, 4),\r\n(3, 8, 2, 4),\r\n(4, 1, 3, 3),\r\n(5, 5, 1, 3);<\/code><\/pre>\n<\/div>\n<p>\u6700\u5f8c\u306b\u3001\u55b6\u696d\u30c1\u30fc\u30e0\u306e\u8ab0\u3082\u95a2\u4e0e\u3057\u3066\u3044\u306a\u3044\u72b6\u614b\u3067\u4f1a\u793e\u304c\u6570\u4ef6\u306e\u58f2\u4e0a\u3092\u9054\u6210\u3057\u305f\u3068\u60f3\u50cf\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u308c\u3089\u306e\u58f2\u4e0a\u3092\u8a18\u9332\u3059\u308b\u306b\u306f\u3001\u6b21\u306e\u64cd\u4f5c\u3092\u5b9f\u884c\u3057\u3066\u3001Sales\u30c6\u30fc\u30d6\u30eb\u306bSalesperson\u5217\u306b\u5024\u304c\u306a\u30443\u884c\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-sql\" data-lang=\"SQL\"><code>INSERT INTO sales (saleID, quantity, productID)\r\nVALUES\r\n(6, 1, 5),\r\n(7, 3, 1),\r\n(8, 4, 5);<\/code><\/pre>\n<\/div>\n<p>\u3053\u308c\u3067\u3001\u30ac\u30a4\u30c9\u306e\u6b8b\u308a\u306e\u90e8\u5206\u306b\u9032\u307f\u3001SQL \u3067\u30c6\u30fc\u30d6\u30eb\u3092\u7d50\u5408\u3059\u308b\u65b9\u6cd5\u3092\u5b66\u7fd2\u3059\u308b\u6e96\u5099\u304c\u6574\u3044\u307e\u3057\u305f\u3002.<\/p>\n<h5 id=\"%d8%af%d8%b1%da%a9-%d9%86%d8%ad%d9%88-%d8%b9%d9%85%d9%84%db%8c%d8%a7%d8%aa-join\">JOIN\u64cd\u4f5c\u306e\u69cb\u6587\u3092\u7406\u89e3\u3059\u308b<\/h5>\n<p>JOIN\u53e5\u306f\u3001UPDATE\u64cd\u4f5c\u3084DELETE\u64cd\u4f5c\u306a\u3069\u3001\u3055\u307e\u3056\u307e\u306aSQL\u6587\u3067\u4f7f\u7528\u3067\u304d\u307e\u3059\u3002\u305f\u3060\u3057\u3001\u3053\u306e\u30ac\u30a4\u30c9\u306e\u4f8b\u3067\u306f\u3001\u8aac\u660e\u306e\u305f\u3081\u3001SELECT\u30af\u30a8\u30ea\u3092\u4f7f\u7528\u3057\u3066JOIN\u53e5\u306e\u52d5\u4f5c\u3092\u8aac\u660e\u3057\u307e\u3059\u3002.<\/p>\n<p>\u6b21\u306e\u4f8b\u306f\u3001JOIN \u53e5\u3092\u542b\u3080 SELECT \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u306e\u4e00\u822c\u7684\u306a\u69cb\u6587\u3092\u793a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-sql\" data-lang=\"SQL\"><code>SELECT table1.column1, table2.column2\r\nFROM table1 JOIN table2\r\nON search_condition;<\/code><\/pre>\n<\/div>\n<p>\u3053\u306e\u69cb\u6587\u306f\u30012\u3064\u306e\u7570\u306a\u308b\u30c6\u30fc\u30d6\u30eb\u304b\u30892\u3064\u306e\u5217\u3092\u8fd4\u3059SELECT\u6587\u3067\u59cb\u307e\u308a\u307e\u3059\u3002JOIN\u53e5\u306f\u8907\u6570\u306e\u30c6\u30fc\u30d6\u30eb\u306e\u5185\u5bb9\u3092\u6bd4\u8f03\u3059\u308b\u305f\u3081\u3001\u3053\u306e\u4f8b\u306e\u69cb\u6587\u3067\u306f\u3001\u5404\u5217\u304c\u3069\u306e\u30c6\u30fc\u30d6\u30eb\u304b\u3089\u9078\u629e\u3055\u308c\u308b\u304b\u3092\u6307\u5b9a\u3059\u308b\u305f\u3081\u306b\u3001\u5217\u540d\u306e\u524d\u306b\u30c6\u30fc\u30d6\u30eb\u540d\u3068\u30d4\u30ea\u30aa\u30c9\u3092\u4ed8\u3051\u308b\u3053\u3068\u306b\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u308c\u306f\u5b8c\u5168\u4fee\u98fe\u5217\u53c2\u7167\u3068\u547c\u3070\u308c\u307e\u3059\u3002.<\/p>\n<p>\u3053\u306e\u3088\u3046\u306a\u5b8c\u5168\u4fee\u98fe\u5217\u53c2\u7167\u306f\u3069\u306e\u64cd\u4f5c\u3067\u3082\u4f7f\u7528\u3067\u304d\u307e\u3059\u304c\u3001\u6280\u8853\u7684\u306b\u306f\u7570\u306a\u308b\u30c6\u30fc\u30d6\u30eb\u306e2\u3064\u306e\u5217\u304c\u540c\u3058\u540d\u524d\u3092\u6301\u3064\u64cd\u4f5c\u3067\u306e\u307f\u5fc5\u8981\u3067\u3059\u3002\u305f\u3060\u3057\u3001\u8907\u6570\u306e\u30c6\u30fc\u30d6\u30eb\u3092\u64cd\u4f5c\u3059\u308b\u5834\u5408\u306f\u3001JOIN\u64cd\u4f5c\u306e\u53ef\u8aad\u6027\u3068\u7406\u89e3\u5ea6\u3092\u5411\u4e0a\u3055\u305b\u308b\u305f\u3081\u3001\u5b8c\u5168\u4fee\u98fe\u5217\u53c2\u7167\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3092\u304a\u52e7\u3081\u3057\u307e\u3059\u3002.<\/p>\n<p>SELECT \u306e\u5f8c\u306b FROM \u53e5\u304c\u7d9a\u304d\u307e\u3059\u3002\u3069\u306e\u30af\u30a8\u30ea\u3067\u3082\u3001FROM \u53e5\u306f\u3001\u5fc5\u8981\u306a\u30c7\u30fc\u30bf\u3092\u8fd4\u3059\u305f\u3081\u306b\u691c\u7d22\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3092\u5b9a\u7fa9\u3059\u308b\u5834\u6240\u3067\u3059\u3002\u3053\u3053\u3067\u306e\u552f\u4e00\u306e\u9055\u3044\u306f\u3001FROM \u53e5\u304c JOIN \u30ad\u30fc\u30ef\u30fc\u30c9\u3067\u533a\u5207\u3089\u308c\u305f 2 \u3064\u306e\u30c6\u30fc\u30d6\u30eb\u3067\u69cb\u6210\u3055\u308c\u308b\u3053\u3068\u3067\u3059\u3002\u30af\u30a8\u30ea\u3092\u4f5c\u6210\u3059\u308b\u969b\u306e\u4fbf\u5229\u306a\u8003\u3048\u65b9\u3068\u3057\u3066\u3001\u3069\u306e\u30c6\u30fc\u30d6\u30eb\u304b\u3089\u3069\u306e\u5217\u304c\u8fd4\u3055\u308c\u308b\u304b\u3092\u9078\u629e\u3059\u308b\u3053\u3068\u3092\u5fd8\u308c\u306a\u3044\u3088\u3046\u306b\u3059\u308b\u3053\u3068\u304c\u6319\u3052\u3089\u308c\u307e\u3059\u3002.<\/p>\n<p>\u6b21\u306b\u3001\u691c\u7d22\u6761\u4ef6\u3092\u5b9a\u7fa9\u3057\u3066\u30af\u30a8\u30ea\u304c2\u3064\u306e\u30c6\u30fc\u30d6\u30eb\u3092\u3069\u306e\u3088\u3046\u306b\u7d50\u5408\u3059\u308b\u304b\u3092\u6307\u5b9a\u3059\u308bON\u53e5\u304c\u3042\u308a\u307e\u3059\u3002\u691c\u7d22\u6761\u4ef6\u3068\u306f\u3001\u7279\u5b9a\u306e\u6761\u4ef6\u306b\u5bfe\u3057\u3066\u300ctrue\u300d\u3001\u300cfalse\u300d\u3001\u307e\u305f\u306f\u300cunknown\u300d\u3068\u8a55\u4fa1\u3055\u308c\u308b1\u3064\u4ee5\u4e0a\u306e\u6587\u307e\u305f\u306f\u5f0f\u306e\u96c6\u5408\u3067\u3059\u3002JOIN\u64cd\u4f5c\u306f\u3001\u4e21\u65b9\u306e\u30c6\u30fc\u30d6\u30eb\u306e\u3059\u3079\u3066\u306e\u884c\u3092\u7d50\u5408\u3057\u3001ON\u53e5\u306e\u691c\u7d22\u6761\u4ef6\u304c\u300ctrue\u300d\u3068\u8a55\u4fa1\u3055\u308c\u308b\u3059\u3079\u3066\u306e\u884c\u3092\u8fd4\u3059\u3068\u8003\u3048\u308b\u3068\u5206\u304b\u308a\u3084\u3059\u3044\u3067\u3057\u3087\u3046\u3002.<\/p>\n<p>ON \u53e5\u3067\u306f\u3001\u901a\u5e38\u3001\u95a2\u9023\u3059\u308b2\u3064\u306e\u5217\uff08\u3042\u308b\u30c6\u30fc\u30d6\u30eb\u306e\u5916\u90e8\u30ad\u30fc\u3068\u3001\u305d\u306e\u5916\u90e8\u30ad\u30fc\u304c\u53c2\u7167\u3059\u308b\u5225\u306e\u30c6\u30fc\u30d6\u30eb\u306e\u4e3b\u30ad\u30fc\u306a\u3069\uff09\u306e\u5024\u304c\u7b49\u3057\u3044\u304b\u3069\u3046\u304b\u3092\u30c6\u30b9\u30c8\u3059\u308b\u691c\u7d22\u6761\u4ef6\u3092\u542b\u3081\u308b\u3053\u3068\u304c\u9069\u5207\u3067\u3059\u3002\u3053\u308c\u306f\u3001\u7b49\u4fa1\u7d50\u5408\u3068\u547c\u3070\u308c\u308b\u3053\u3068\u3082\u3042\u308a\u307e\u3059\u3002.<\/p>\n<p>equi\u304c\u8907\u6570\u306e\u30c6\u30fc\u30d6\u30eb\u304b\u3089\u4e00\u81f4\u3059\u308b\u30c7\u30fc\u30bf\u3092\u7d50\u5408\u3059\u308b\u65b9\u6cd5\u306e\u4f8b\u3068\u3057\u3066\u3001\u5148\u307b\u3069\u8ffd\u52a0\u3057\u305f\u30b5\u30f3\u30d7\u30eb\u30c7\u30fc\u30bf\u3092\u4f7f\u7528\u3057\u3066\u6b21\u306e\u30af\u30a8\u30ea\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002\u3053\u306e\u30af\u30a8\u30ea\u306f\u3001Products\u30c6\u30fc\u30d6\u30eb\u3068Team\u30c6\u30fc\u30d6\u30eb\u3092\u3001\u305d\u308c\u305e\u308c\u306eproductID\u5217\u3068productSpecialty\u5217\u306e\u4e00\u81f4\u3059\u308b\u5024\u3092\u30c6\u30b9\u30c8\u3059\u308b\u691c\u7d22\u6761\u4ef6\u3067\u7d50\u5408\u3057\u307e\u3059\u3002\u305d\u3057\u3066\u3001\u5404\u55b6\u696d\u30c1\u30fc\u30e0\u30e1\u30f3\u30d0\u30fc\u306e\u540d\u524d\u3001\u5f7c\u3089\u304c\u5c02\u9580\u3068\u3059\u308b\u5404\u88fd\u54c1\u306e\u540d\u524d\u3001\u305d\u3057\u3066\u305d\u308c\u3089\u306e\u88fd\u54c1\u306e\u4fa1\u683c\u3092\u8fd4\u3057\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-sql\" data-lang=\"SQL\"><code>SELECT team.empName, products.productName, products.price\r\nFROM products JOIN team\r\nON products.productID = team.productSpecialty<\/code><\/pre>\n<\/div>\n<p>\u062f\u0631 \u0627\u06cc\u0646\u062c\u0627 \u0645\u062c\u0645\u0648\u0639\u0647 \u0646\u062a\u0627\u06cc\u062c \u0627\u06cc\u0646 \u067e\u0631\u0633 \u0648 \u062c\u0648 \u0627\u0633\u062a:<\/p>\n<\/div>\n<div>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code>Output\r\n+----------+-------------+-------+\r\n| empName | productName | price |\r\n+----------+-------------+-------+\r\n| Florence | widget | 18.99 |\r\n| Mary | doodad | 11.50 |\r\n| Diana | thingamajig | 39.99 |\r\n| Betty | gizmo | 14.49 |\r\n+----------+-------------+-------+\r\n4 rows in set (0.00 sec)<\/code><\/pre>\n<\/div>\n<\/div>\n<div>\n<p>SQL\u304c\u3053\u308c\u3089\u306e\u30c6\u30fc\u30d6\u30eb\u3092\u7d50\u5408\u3057\u3066\u7d50\u679c\u30bb\u30c3\u30c8\u3092\u4f5c\u6210\u3059\u308b\u4ed5\u7d44\u307f\u3092\u7406\u89e3\u3059\u308b\u305f\u3081\u306b\u3001\u30d7\u30ed\u30bb\u30b9\u3092\u8a73\u3057\u304f\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002\u5ff5\u306e\u305f\u3081\u8a00\u3063\u3066\u304a\u304d\u307e\u3059\u304c\u3001\u4ee5\u4e0b\u306f\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u7ba1\u7406\u30b7\u30b9\u30c6\u30e0\u304c2\u3064\u306e\u30c6\u30fc\u30d6\u30eb\u3092\u7d50\u5408\u3059\u308b\u5177\u4f53\u7684\u306a\u65b9\u6cd5\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u304c\u3001JOIN\u64cd\u4f5c\u3092\u624b\u9806\u3068\u3057\u3066\u8003\u3048\u308b\u3068\u5206\u304b\u308a\u3084\u3059\u3044\u3067\u3057\u3087\u3046\u3002.<\/p>\n<p>\u307e\u305a\u3001\u30af\u30a8\u30ea\u306f FROM \u53e5\u306e\u6700\u521d\u306e\u30c6\u30fc\u30d6\u30eb\u306e\u5404\u884c\u3068\u5217\u306e\u88fd\u54c1\u3092\u51fa\u529b\u3057\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code>JOIN Process Example\r\n+-----------+-------------+-------+\r\n| productID | productName | price |\r\n+-----------+-------------+-------+\r\n| 1 | widget | 18.99 |\r\n| 2 | gizmo | 14.49 |\r\n| 3 | thingamajig | 39.99 |\r\n| 4 | doodad | 11.50 |\r\n| 5 | whatzit | 29.99 |\r\n+-----------+-------------+-------+<\/code><\/pre>\n<div>\u0633\u067e\u0633\u060c \u0628\u0647 \u0647\u0631 \u06cc\u06a9 \u0627\u0632 \u0627\u06cc\u0646 \u0631\u062f\u06cc\u0641\u200c\u0647\u0627 \u0646\u06af\u0627\u0647 \u0645\u06cc\u200c\u06a9\u0646\u062f \u0648 \u0628\u0627 \u0647\u0631 \u0631\u062f\u06cc\u0641\u06cc \u0627\u0632 \u062c\u062f\u0648\u0644 \u062a\u06cc\u0645 \u06a9\u0647 productSpecialty \u0622\u0646 \u0628\u0631\u0627\u0628\u0631 \u0628\u0627 \u0645\u0642\u062f\u0627\u0631 productID \u062f\u0631 \u0622\u0646 \u0633\u0637\u0631 \u0627\u0633\u062a\u060c \u0645\u0637\u0627\u0628\u0642\u062a \u0645\u06cc\u200c\u062f\u0647\u062f:<\/div>\n<div>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code>JOIN Process Example\r\n+-----------+-------------+-------+-------+----------+------------------+\r\n| productID | productName | price | empID | empName | productSpecialty |\r\n+-----------+-------------+-------+-------+----------+------------------+\r\n| 1 | widget | 18.99 | 1 | Florence | 1 |\r\n| 2 | gizmo | 14.49 | 4 | Betty | 2 |\r\n| 3 | thingamajig | 39.99 | 3 | Diana | 3 |\r\n| 4 | doodad | 11.50 | 2 | Mary | 4 |\r\n| 5 | whatzit | 29.99 | | | |\r\n+-----------+-------------+-------+-------+----------+------------------+<\/code><\/pre>\n<div>\u0633\u067e\u0633\u060c \u0633\u0637\u0631\u0647\u0627\u06cc\u06cc \u0631\u0627 \u06a9\u0647 \u0645\u0637\u0627\u0628\u0642\u062a \u0646\u062f\u0627\u0631\u0646\u062f \u0631\u0627 \u0628\u0631\u0634 \u0645\u06cc\u200c\u062f\u0647\u062f \u0648 \u0633\u062a\u0648\u0646\u200c\u0647\u0627 \u0631\u0627 \u0628\u0631 \u0627\u0633\u0627\u0633 \u062a\u0631\u062a\u06cc\u0628 \u0622\u0646\u0647\u0627 \u062f\u0631 \u0639\u0628\u0627\u0631\u062a SELECT \u0645\u0631\u062a\u0628 \u0645\u06cc\u200c\u06a9\u0646\u062f\u060c \u0633\u062a\u0648\u0646\u200c\u0647\u0627\u06cc\u06cc \u0631\u0627 \u06a9\u0647 \u0645\u0634\u062e\u0635 \u0646\u0634\u062f\u0647 \u0628\u0648\u062f\u0646\u062f \u062d\u0630\u0641 \u0645\u06cc\u200c\u06a9\u0646\u062f\u060c \u0631\u062f\u06cc\u0641\u200c\u0647\u0627 \u0631\u0627 \u0645\u062a\u0648\u0633\u0644 \u0645\u06cc\u200c\u06a9\u0646\u062f \u0648 \u0645\u062c\u0645\u0648\u0639\u0647 \u0646\u062a\u0627\u06cc\u062c \u0646\u0647\u0627\u06cc\u06cc \u0631\u0627 \u0628\u0631\u0645\u06cc\u200c\u06af\u0631\u062f\u0627\u0646\u062f:<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code>JOIN Process Example\r\n+----------+-------------+-------+\r\n| empName | productName | price |\r\n+----------+-------------+-------+\r\n| Florence | widget | 18.99 |\r\n| Mary | doodad | 11.50 |\r\n| Diana | thingamajig | 39.99 |\r\n| Betty | gizmo | 14.49 |\r\n+----------+-------------+-------+\r\n4 rows in set (0.00 sec)<\/code><\/pre>\n<\/div>\n<\/div>\n<div>\n<p>\u7b49\u4fa1\u7d50\u5408\u306f\u30c6\u30fc\u30d6\u30eb\u3092\u7d50\u5408\u3059\u308b\u6700\u3082\u4e00\u822c\u7684\u306a\u65b9\u6cd5\u3067\u3059\u304c\u3001ON\u53e5\u306e\u691c\u7d22\u6761\u4ef6\u3067\u306f&lt;\u3001&gt;\u3001LIKE\u3001NOT LIKE\u3001\u3055\u3089\u306b\u306fBETWEEN\u306a\u3069\u306e\u4ed6\u306eSQL\u6f14\u7b97\u5b50\u3082\u4f7f\u7528\u3067\u304d\u307e\u3059\u3002\u305f\u3060\u3057\u3001\u3088\u308a\u8907\u96d1\u306a\u691c\u7d22\u6761\u4ef6\u3092\u4f7f\u7528\u3059\u308b\u3068\u3001\u7d50\u679c\u30bb\u30c3\u30c8\u306b\u8868\u793a\u3055\u308c\u308b\u30c7\u30fc\u30bf\u3092\u4e88\u6e2c\u3059\u308b\u3053\u3068\u304c\u96e3\u3057\u304f\u306a\u308b\u5834\u5408\u304c\u3042\u308b\u3053\u3068\u306b\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002.<\/p>\n<p>\u307b\u3068\u3093\u3069\u306e\u5b9f\u88c5\u3067\u306f\u3001SQL\u6a19\u6e96\u3067\u300cqualified JOIN\u300d\u30c7\u30fc\u30bf\u578b\u3068\u547c\u3070\u308c\u308b\u5217\u30bb\u30c3\u30c8\u3092\u4f7f\u7528\u3057\u3066\u30c6\u30fc\u30d6\u30eb\u3092\u7d50\u5408\u3067\u304d\u307e\u3059\u3002\u3053\u308c\u306f\u3001\u4e00\u822c\u7684\u306b\u3001\u5bfe\u5fdc\u3059\u308b\u30c7\u30fc\u30bf\u578b\u306b\u95a2\u4fc2\u306a\u304f\u3001\u6570\u5024\u30c7\u30fc\u30bf\u3092\u4fdd\u6301\u3059\u308b\u5217\u3092\u6570\u5024\u30c7\u30fc\u30bf\u3092\u4fdd\u6301\u3059\u308b\u4ed6\u306e\u4efb\u610f\u306e\u5217\u3068\u7d50\u5408\u3067\u304d\u308b\u3053\u3068\u3092\u610f\u5473\u3057\u307e\u3059\u3002\u540c\u69d8\u306b\u3001\u6587\u5b57\u5024\u3092\u4fdd\u6301\u3059\u308b\u4efb\u610f\u306e\u5217\u3092\u6587\u5b57\u30c7\u30fc\u30bf\u3092\u4fdd\u6301\u3059\u308b\u4ed6\u306e\u4efb\u610f\u306e\u5217\u3068\u7d50\u5408\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002\u524d\u8ff0\u306e\u3088\u3046\u306b\u30012\u3064\u306e\u30c6\u30fc\u30d6\u30eb\u3092\u7d50\u5408\u3059\u308b\u305f\u3081\u306b\u4e00\u81f4\u3055\u305b\u308b\u5217\u306f\u901a\u5e38\u3001\u30c6\u30fc\u30d6\u30eb\u9593\u306e\u95a2\u4fc2\u3092\u8868\u3059\u5217\u3067\u3059\u3002\u4f8b\u3048\u3070\u3001\u5916\u90e8\u30ad\u30fc\u3068\u305d\u308c\u304c\u53c2\u7167\u3059\u308b\u5225\u306e\u30c6\u30fc\u30d6\u30eb\u306e\u4e3b\u30ad\u30fc\u306a\u3069\u3067\u3059\u3002.<\/p>\n<p>\u591a\u304f\u306eSQL\u5b9f\u88c5\u3067\u306f\u3001ON\u3067\u306f\u306a\u304fUSING\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u4f7f\u7528\u3057\u3066\u3001\u540c\u3058\u540d\u524d\u306e\u5217\u3092\u7d50\u5408\u3067\u304d\u307e\u3059\u3002\u3053\u306e\u3088\u3046\u306a\u64cd\u4f5c\u306e\u69cb\u6587\u306f\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-sql\" data-lang=\"SQL\"><code>SELECT table1.column1, table2.column2\r\nFROM table1 JOIN table2\r\nUSING (related_column);<\/code><\/pre>\n<\/div>\n<\/div>\n<div>\n<p>\u3053\u306e\u4f8b\u306e\u69cb\u6587\u3067\u306f\u3001USING \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u306f ON table1.related_column = table2.related_column; \u3068\u540c\u7b49\u3067\u3059\u3002.<\/p>\n<p>sales\u3068products\u306b\u306f\u305d\u308c\u305e\u308cproductID\u3068\u3044\u3046\u5217\u304c\u3042\u308b\u305f\u3081\u3001USING\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u4f7f\u7528\u3057\u3066\u3053\u308c\u3089\u306e\u5217\u3092\u7d50\u5408\u3067\u304d\u307e\u3059\u3002\u6b21\u306e\u6587\u306f\u3053\u308c\u3092\u5b9f\u884c\u3057\u3001\u5404sale\u306esaleID\u3001\u8ca9\u58f2\u6570\u3001\u8ca9\u58f2\u3055\u308c\u305f\u5404\u88fd\u54c1\u306e\u540d\u524d\u3001\u304a\u3088\u3073\u4fa1\u683c\u3092\u8fd4\u3057\u307e\u3059\u3002\u307e\u305f\u3001\u7d50\u679c\u30bb\u30c3\u30c8\u3092saleID\u306e\u5024\u3067\u6607\u9806\u306b\u4e26\u3079\u66ff\u3048\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code>SELECT sales.saleID, sales.quantity, products.productName, products.price\r\nFROM sales JOIN products\r\nUSING (productID)\r\nORDER BY saleID;<\/code><\/pre>\n<\/div>\n<\/div>\n<div>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code>Output\r\n+--------+----------+-------------+-------+\r\n| saleID | quantity | productName | price |\r\n+--------+----------+-------------+-------+\r\n| 1 | 7 | widget | 18.99 |\r\n| 2 | 10 | whatzit | 29.99 |\r\n| 3 | 8 | gizmo | 14.49 |\r\n| 4 | 1 | thingamajig | 39.99 |\r\n| 5 | 5 | widget | 18.99 |\r\n| 6 | 1 | whatzit | 29.99 |\r\n| 7 | 3 | widget | 18.99 |\r\n| 8 | 4 | whatzit | 29.99 |\r\n+--------+----------+-------------+-------+\r\n8 rows in set (0.00 sec)<\/code><\/pre>\n<\/div>\n<\/div>\n<div>\n<p>\u30c6\u30fc\u30d6\u30eb\u3092\u7d50\u5408\u3059\u308b\u969b\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30b7\u30b9\u30c6\u30e0\u306f\u4e88\u6e2c\u3057\u306b\u304f\u3044\u65b9\u6cd5\u3067\u884c\u3092\u914d\u7f6e\u3059\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u306e\u3088\u3046\u306bORDER BY\u53e5\u3092\u542b\u3081\u308b\u3053\u3068\u3067\u3001\u7d50\u679c\u30bb\u30c3\u30c8\u306e\u4e00\u8cab\u6027\u3068\u53ef\u8aad\u6027\u304c\u5411\u4e0a\u3057\u307e\u3059\u3002.<\/p>\n<h5 id=\"%d9%be%db%8c%d9%88%d8%b3%d8%aa%d9%86-%d8%a8%d9%87-%d8%a8%db%8c%d8%b4-%d8%a7%d8%b2-%d8%af%d9%88-%d8%ac%d8%af%d9%88%d9%84\">2\u3064\u4ee5\u4e0a\u306e\u30c6\u30fc\u30d6\u30eb\u3092\u7d50\u5408\u3059\u308b<\/h5>\n<p>2\u3064\u4ee5\u4e0a\u306e\u30c6\u30fc\u30d6\u30eb\u306e\u30c7\u30fc\u30bf\u3092\u7d50\u5408\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002JOIN\u53e5\u3092\u4ed6\u306eJOIN\u53e5\u306e\u4e2d\u306b\u30cd\u30b9\u30c8\u3059\u308b\u3053\u3068\u3067\u3001\u4efb\u610f\u306e\u6570\u306e\u30c6\u30fc\u30d6\u30eb\u3092\u7d50\u5408\u3067\u304d\u307e\u3059\u3002\u4ee5\u4e0b\u306e\u69cb\u6587\u306f\u30013\u3064\u306e\u30c6\u30fc\u30d6\u30eb\u3092\u7d50\u5408\u3059\u308b\u5834\u5408\u306e\u4f8b\u3067\u3059\u3002<\/p>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-sql\" data-lang=\"SQL\"><code>SELECT table1.column1, table2.column2, table3.column3\r\nFROM table1 JOIN table2\r\nON table1.related_column = table2.related_column\r\nJOIN table3\r\nON table3.related_column = table1_or_2.related_column;<\/code><\/pre>\n<\/div>\n<\/div>\n<div>\n<p>\u3053\u306e\u4f8b\u306e\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u306e FROM \u53e5\u306f\u3001\u30c6\u30fc\u30d6\u30eb 1 \u3092\u30c6\u30fc\u30d6\u30eb 2 \u306b\u7d50\u5408\u3059\u308b\u3053\u3068\u304b\u3089\u59cb\u307e\u308a\u307e\u3059\u3002\u3053\u306e ON \u53e5\u306e\u5f8c\u306b\u3001\u7d50\u5408\u3055\u308c\u305f\u30c6\u30fc\u30d6\u30eb\u306e\u6700\u521d\u306e\u30bb\u30c3\u30c8\u3092\u30c6\u30fc\u30d6\u30eb 3 \u3068\u7d44\u307f\u5408\u308f\u305b\u308b 2 \u756a\u76ee\u306e JOIN \u304c\u958b\u59cb\u3055\u308c\u307e\u3059\u30023 \u756a\u76ee\u306e\u30c6\u30fc\u30d6\u30eb\u306f\u3001\u6700\u521d\u306e\u30c6\u30fc\u30d6\u30eb\u307e\u305f\u306f 2 \u756a\u76ee\u306e\u30c6\u30fc\u30d6\u30eb\u306e\u3044\u305a\u308c\u304b\u306e\u5217\u306b\u7d50\u5408\u3067\u304d\u308b\u3053\u3068\u306b\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002.<\/p>\n<p>\u305f\u3068\u3048\u3070\u3001\u5f93\u696d\u54e1\u306e\u58f2\u4e0a\u304c\u3044\u304f\u3089\u306a\u306e\u304b\u3092\u77e5\u308a\u305f\u3044\u304c\u3001\u5f93\u696d\u54e1\u304c\u5c02\u9580\u3068\u3059\u308b\u88fd\u54c1\u306e\u58f2\u4e0a\u3092\u542b\u3080\u58f2\u4e0a\u8a18\u9332\u3060\u3051\u3092\u8abf\u3079\u305f\u3044\u3068\u3057\u307e\u3059\u3002.<\/p>\n<p>\u3053\u306e\u60c5\u5831\u3092\u53d6\u5f97\u3059\u308b\u306b\u306f\u3001\u6b21\u306e\u30af\u30a8\u30ea\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002\u3053\u306e\u30af\u30a8\u30ea\u306f\u3001\u307e\u305aProducts\u30c6\u30fc\u30d6\u30eb\u3068Sales\u30c6\u30fc\u30d6\u30eb\u3092\u3001\u305d\u308c\u305e\u308c\u306eproductID\u5217\u3092\u4e00\u81f4\u3055\u305b\u308b\u3053\u3068\u3067\u7d50\u5408\u3057\u307e\u3059\u3002\u6b21\u306b\u3001\u6700\u521d\u306eJOIN\u306e\u5404\u884c\u3092productSpecialty\u5217\u3068\u4e00\u81f4\u3055\u305b\u308b\u3053\u3068\u3067\u3001Team\u30c6\u30fc\u30d6\u30eb\u3092\u6700\u521d\u306e2\u3064\u306e\u30c6\u30fc\u30d6\u30eb\u306b\u7d50\u5408\u3057\u307e\u3059\u3002\u305d\u3057\u3066\u3001WHERE\u53e5\u3092\u4f7f\u7528\u3057\u3066\u7d50\u679c\u3092\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u3057\u3001\u4e00\u81f4\u3057\u305f\u5f93\u696d\u54e1\u304c\u58f2\u4e0a\u3092\u9054\u6210\u3057\u305f\u4eba\u7269\u3067\u3082\u3042\u308b\u884c\u306e\u307f\u3092\u8fd4\u3057\u307e\u3059\u3002\u307e\u305f\u3001\u3053\u306e\u30af\u30a8\u30ea\u306b\u306fORDER BY\u53e5\u304c\u542b\u307e\u308c\u3066\u304a\u308a\u3001\u6700\u7d42\u7d50\u679c\u3092saleID\u5217\u306e\u5024\u3067\u6607\u9806\u3067\u4e26\u3079\u66ff\u3048\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-sql\" data-lang=\"SQL\"><code>SELECT sales.saleID,\r\nteam.empName,\r\nproducts.productName,\r\n(sales.quantity * products.price)\r\nFROM products JOIN sales\r\nUSING (productID)\r\nJOIN team\r\nON team.productSpecialty = sales.productID\r\nWHERE team.empID = sales.salesperson\r\nORDER BY sales.saleID;\r\n<\/code><\/pre>\n<\/div>\n<\/div>\n<div>SELECT\u6587\u306b\u5217\u6319\u3055\u308c\u3066\u3044\u308b\u5217\u306e\u4e2d\u306b\u3001Sales\u30c6\u30fc\u30d6\u30eb\u306eValue\u5217\u306e\u5024\u3068Products\u30c6\u30fc\u30d6\u30eb\u306ePrice\u5217\u306e\u5024\u3092\u4e57\u7b97\u3059\u308b\u6587\u304c\u3042\u308b\u3053\u3068\u306b\u6ce8\u76ee\u3057\u3066\u304f\u3060\u3055\u3044\u3002Products\u306f\u3001\u4e00\u81f4\u3059\u308b\u884c\u306b\u3053\u308c\u3089\u306e\u5024\u3092\u8fd4\u3057\u307e\u3059\u3002<\/div>\n<div>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code>Output\r\n+--------+----------+-------------+-----------------------------------+\r\n| saleID | empName | productName | (sales.quantity * products.price) |\r\n+--------+----------+-------------+-----------------------------------+\r\n| 1 | Florence | widget | 132.93 |\r\n| 3 | Betty | gizmo | 115.92 |\r\n| 4 | Diana | thingamajig | 39.99 |\r\n+--------+----------+-------------+-----------------------------------+\r\n3 rows in set (0.00 sec)<\/code><\/pre>\n<\/div>\n<\/div>\n<div>\n<p>\u3053\u308c\u307e\u3067\u306e\u4f8b\u306f\u3059\u3079\u3066\u3001\u5185\u90e8\u7d50\u5408\uff08inner JOIN\uff09\u3068\u3044\u30461\u7a2e\u985e\u306eJOIN\u5f0f\u3092\u4f7f\u7528\u3057\u3066\u3044\u307e\u3057\u305f\u3002\u6b21\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001\u5185\u90e8\u7d50\u5408\u3001\u5916\u90e8\u7d50\u5408\u3001\u305d\u3057\u3066\u305d\u308c\u3089\u306e\u9055\u3044\u306b\u3064\u3044\u3066\u6982\u8981\u3092\u8aac\u660e\u3057\u307e\u3059\u3002.<\/p>\n<h2 id=\"%d8%b9%d9%85%d9%84%db%8c%d8%a7%d8%aa-join-%d8%af%d8%a7%d8%ae%d9%84%db%8c-%d8%af%d8%b1-%d9%85%d9%82%d8%a7%d8%a8%d9%84-%d8%a8%db%8c%d8%b1%d9%88%d9%86%db%8c\">\u5185\u90e8JOIN\u64cd\u4f5c\u3068\u5916\u90e8JOIN\u64cd\u4f5c<\/h2>\n<p>JOIN\u6587\u306b\u306f\u4e3b\u306b2\u3064\u306e\u7a2e\u985e\u304c\u3042\u308a\u307e\u3059\u3002INNER\u7d50\u5408\u3068OUTER\u7d50\u5408\u3067\u3059\u3002\u3053\u308c\u30892\u7a2e\u985e\u306e\u7d50\u5408\u306e\u9055\u3044\u306f\u3001\u8fd4\u3055\u308c\u308b\u30c7\u30fc\u30bf\u3067\u3059\u3002INNER\u7d50\u5408\u306f\u7d50\u5408\u3055\u308c\u305f\u5404\u30c6\u30fc\u30d6\u30eb\u304b\u3089\u4e00\u81f4\u3059\u308b\u884c\u306e\u307f\u3092\u8fd4\u3057\u307e\u3059\u304c\u3001OUTER\u7d50\u5408\u306f\u4e00\u81f4\u3059\u308b\u884c\u3068\u4e00\u81f4\u3057\u306a\u3044\u884c\u306e\u4e21\u65b9\u3092\u8fd4\u3057\u307e\u3059\u3002.<\/p>\n<p>\u524d\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u306e\u69cb\u6587\u3068\u30b5\u30f3\u30d7\u30eb\u30af\u30a8\u30ea\u306f\u3059\u3079\u3066INNER JOIN\u6587\u3092\u4f7f\u7528\u3057\u3066\u3044\u307e\u3059\u304c\u3001INNER\u30ad\u30fc\u30ef\u30fc\u30c9\u306f\u542b\u307e\u308c\u3066\u3044\u307e\u305b\u3093\u3002\u307b\u3068\u3093\u3069\u306eSQL\u5b9f\u88c5\u3067\u306f\u3001\u660e\u793a\u7684\u306b\u6307\u5b9a\u3055\u308c\u3066\u3044\u306a\u3044\u9650\u308a\u3001\u3059\u3079\u3066\u306eJOIN\u6587\u306fINNER\u7d50\u5408\u3068\u3057\u3066\u6271\u308f\u308c\u307e\u3059\u3002.<\/p>\n<p>\u5916\u90e8\u7d50\u5408\u3092\u6307\u5b9a\u3057\u305f\u30af\u30a8\u30ea\u306f\u8907\u6570\u306e\u30c6\u30fc\u30d6\u30eb\u3092\u7d50\u5408\u3057\u3001\u4e00\u81f4\u3059\u308b\u884c\u3068\u4e00\u81f4\u3057\u306a\u3044\u884c\u306e\u4e21\u65b9\u3092\u8fd4\u3057\u307e\u3059\u3002\u3053\u308c\u306f\u3001\u6b20\u640d\u5024\u306e\u3042\u308b\u884c\u3092\u691c\u7d22\u3059\u308b\u5834\u5408\u3084\u3001\u90e8\u5206\u4e00\u81f4\u304c\u8a31\u5bb9\u3055\u308c\u308b\u5834\u5408\u306b\u5f79\u7acb\u3061\u307e\u3059\u3002.<\/p>\n<p>\u5916\u90e8\u7d50\u5408\u64cd\u4f5c\u306f\u3001LEFT OUTER \u7d50\u5408\u3001RIGHT OUTER \u7d50\u5408\u3001\u304a\u3088\u3073 FULL OUTER \u7d50\u5408\u306e 3 \u7a2e\u985e\u306b\u5206\u3051\u3089\u308c\u307e\u3059\u3002LEFT OUTER \u7d50\u5408 (\u307e\u305f\u306f\u5358\u306b\u5de6\u7d50\u5408) \u306f\u3001\u7d50\u5408\u3055\u308c\u305f 2 \u3064\u306e\u30c6\u30fc\u30d6\u30eb\u304b\u3089\u4e00\u81f4\u3059\u308b\u3059\u3079\u3066\u306e\u884c\u3068\u3001\u300c\u5de6\u300d\u306e\u30c6\u30fc\u30d6\u30eb\u304b\u3089\u4e00\u81f4\u3057\u306a\u3044\u3059\u3079\u3066\u306e\u884c\u3092\u8fd4\u3057\u307e\u3059\u3002JOIN \u64cd\u4f5c\u306e\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u3067\u306f\u3001\u300c\u5de6\u300d\u306e\u30c6\u30fc\u30d6\u30eb\u306f\u5e38\u306b FROM \u30ad\u30fc\u30ef\u30fc\u30c9\u306e\u76f4\u5f8c\u3067 JOIN \u30ad\u30fc\u30ef\u30fc\u30c9\u306e\u5de6\u5074\u306b\u6307\u5b9a\u3055\u308c\u308b\u6700\u521d\u306e\u30c6\u30fc\u30d6\u30eb\u3067\u3059\u3002\u540c\u69d8\u306b\u3001\u300c\u53f3\u300d\u306e\u30c6\u30fc\u30d6\u30eb\u306f 2 \u756a\u76ee\u306e\u30c6\u30fc\u30d6\u30eb\u3001\u3064\u307e\u308a JOIN \u306e\u76f4\u5f8c\u306b\u6307\u5b9a\u3055\u308c\u308b\u30c6\u30fc\u30d6\u30eb\u3067\u3059\u3002RIGHT OUTER \u7d50\u5408\u306f\u3001\u7d50\u5408\u3055\u308c\u305f\u30c6\u30fc\u30d6\u30eb\u304b\u3089\u4e00\u81f4\u3059\u308b\u3059\u3079\u3066\u306e\u884c\u3068\u3001\u300c\u53f3\u300d\u306e\u30c6\u30fc\u30d6\u30eb\u304b\u3089\u4e00\u81f4\u3057\u306a\u3044\u3059\u3079\u3066\u306e\u884c\u3092\u8fd4\u3057\u307e\u3059\u3002FULL OUTER JOIN \u306f\u3001\u4e21\u65b9\u306e\u30c6\u30fc\u30d6\u30eb\u304b\u3089\u3059\u3079\u3066\u306e\u884c\u3092\u8fd4\u3057\u307e\u3059\u304c\u3001\u3053\u308c\u306b\u306f\u3044\u305a\u308c\u304b\u306e\u30c6\u30fc\u30d6\u30eb\u306e\u4e00\u81f4\u3057\u306a\u3044\u884c\u3082\u542b\u307e\u308c\u307e\u3059\u3002.<\/p>\n<p>\u3053\u308c\u3089\u306e\u7570\u306a\u308b\u7a2e\u985e\u306eJOIN\u53e5\u304c\u3069\u306e\u3088\u3046\u306b\u30c7\u30fc\u30bf\u3092\u8fd4\u3059\u304b\u3092\u78ba\u8a8d\u3059\u308b\u305f\u3081\u306b\u3001\u524d\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u300c\u30b5\u30f3\u30d7\u30eb\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3078\u306e\u63a5\u7d9a\u3068\u8a2d\u5b9a\u300d\u3067\u4f5c\u6210\u3057\u305f\u30c6\u30fc\u30d6\u30eb\u306b\u5bfe\u3057\u3066\u3001\u4ee5\u4e0b\u306e\u30b5\u30f3\u30d7\u30eb\u30af\u30a8\u30ea\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u308c\u3089\u306e\u30af\u30a8\u30ea\u306f\u3001\u305d\u308c\u305e\u308c\u7570\u306a\u308b\u7a2e\u985e\u306eJOIN\u53e5\u3092\u6307\u5b9a\u3057\u3066\u3044\u308b\u3053\u3068\u3092\u9664\u3051\u3070\u3001\u540c\u4e00\u3067\u3059\u3002.<\/p>\n<p>\u3053\u306e\u6700\u521d\u306e\u4f8b\u3067\u306f\u3001\u5185\u90e8\u7d50\u5408\u3092\u4f7f\u7528\u3057\u3066\u3001\u5bfe\u5fdc\u3059\u308b\u55b6\u696d\u62c5\u5f53\u5217\u3068\u5f93\u696d\u54e1ID\u5217\u3092\u7167\u5408\u3059\u308b\u3053\u3068\u3067\u3001sales\u30c6\u30fc\u30d6\u30eb\u3068team\u30c6\u30fc\u30d6\u30eb\u3092\u7d50\u5408\u3057\u3066\u3044\u307e\u3059\u3002\u3053\u3053\u3067\u3082\u3001INNER\u30ad\u30fc\u30ef\u30fc\u30c9\u306f\u660e\u793a\u7684\u306b\u542b\u307e\u308c\u3066\u3044\u306a\u3044\u306b\u3082\u304b\u304b\u308f\u3089\u305a\u3001\u6697\u9ed9\u7684\u306b\u4f7f\u7528\u3055\u308c\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-sql\" data-lang=\"SQL\"><code>SELECT sales.saleID, sales.quantity, sales.salesperson, team.empName \r\nFROM sales JOIN team\r\nON sales.salesperson = team.empID;<\/code><\/pre>\n<\/div>\n<\/div>\n<div>\u3053\u306e\u30af\u30a8\u30ea\u306f\u5185\u90e8 JOIN \u53e5\u3092\u4f7f\u7528\u3059\u308b\u305f\u3081\u3001\u4e21\u65b9\u306e\u30c6\u30fc\u30d6\u30eb\u304b\u3089\u4e00\u81f4\u3059\u308b\u884c\u306e\u307f\u304c\u8fd4\u3055\u308c\u307e\u3059\u3002<\/div>\n<div>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\">Output\r\n+--------+----------+-------------+----------+\r\n| saleID | quantity | salesperson | empName |\r\n+--------+----------+-------------+----------+\r\n| 1 | 7 | 1 | Florence |\r\n| 4 | 1 | 3 | Diana |\r\n| 5 | 5 | 3 | Diana |\r\n| 2 | 10 | 4 | Betty |\r\n| 3 | 8 | 4 | Betty |\r\n+--------+----------+-------------+----------+\r\n5 rows in set (0.00 sec)<\/pre>\n<\/div>\n<\/div>\n<div>\u3053\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306e\u30af\u30a8\u30ea\u3067\u306f\u3001\u4ee3\u308f\u308a\u306b LEFT OUTER JOIN \u53e5\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/div>\n<div>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-sql\" data-lang=\"SQL\"><code>SELECT sales.saleID, sales.quantity, sales.salesperson, team.empName\r\nFROM sales LEFT OUTER JOIN team\r\nON sales.salesperson = team.empID;<\/code><\/pre>\n<\/div>\n<\/div>\n<div>\u524d\u306e\u30af\u30a8\u30ea\u3068\u540c\u69d8\u306b\u3001\u3053\u306e\u30af\u30a8\u30ea\u3082\u4e21\u65b9\u306e\u30c6\u30fc\u30d6\u30eb\u304b\u3089\u4e00\u81f4\u3059\u308b\u5024\u3092\u8fd4\u3057\u307e\u3059\u3002\u305f\u3060\u3057\u3001\u300c\u5de6\u300d\u30c6\u30fc\u30d6\u30eb\uff08\u3053\u306e\u5834\u5408\u306fSales\uff09\u306e\u5024\u306e\u3046\u3061\u3001\u300c\u53f3\u300d\u30c6\u30fc\u30d6\u30eb\uff08Team\uff09\u306b\u4e00\u81f4\u3059\u308b\u5024\u304c\u306a\u3044\u3082\u306e\u306f\u8fd4\u3057\u307e\u3059\u3002\u5de6\u30c6\u30fc\u30d6\u30eb\u306e\u3053\u308c\u3089\u306e\u884c\u306f\u53f3\u30c6\u30fc\u30d6\u30eb\u306b\u4e00\u81f4\u3059\u308b\u884c\u304c\u306a\u3044\u305f\u3081\u3001\u4e00\u81f4\u3057\u306a\u3044\u5024\u306fNULL\u3068\u3057\u3066\u8fd4\u3055\u308c\u307e\u3059\u3002<\/div>\n<div>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code>Output\r\n+--------+----------+-------------+----------+\r\n| saleID | quantity | salesperson | empName |\r\n+--------+----------+-------------+----------+\r\n| 1 | 7 | 1 | Florence |\r\n| 2 | 10 | 4 | Betty |\r\n| 3 | 8 | 4 | Betty |\r\n| 4 | 1 | 3 | Diana |\r\n| 5 | 5 | 3 | Diana |\r\n| 6 | 1 | NULL | NULL |\r\n| 7 | 3 | NULL | NULL |\r\n| 8 | 4 | NULL | NULL |\r\n+--------+----------+-------------+----------+\r\n8 rows in set (0.00 sec)<\/code><\/pre>\n<\/div>\n<\/div>\n<div>\u6b21\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306e\u30af\u30a8\u30ea\u3067\u306f\u3001\u4ee3\u308f\u308a\u306b RIGHT JOIN \u53e5\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/div>\n<div>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-sql\" data-lang=\"SQL\"><code>SELECT sales.saleID, sales.quantity, sales.salesperson, team.empName\r\nFROM sales RIGHT JOIN team\r\nON sales.salesperson = team.empID;<\/code><\/pre>\n<\/div>\n<\/div>\n<div>\n<p>\u3053\u306e\u30af\u30a8\u30ea\u306eJOIN\u53e5\u306f\u3001RIGHT OUTER JOIN\u3067\u306f\u306a\u304fRIGHT JOIN\u3068\u8a18\u8ff0\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u306b\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002INNER JOIN\u53e5\u3092\u6307\u5b9a\u3059\u308b\u305f\u3081\u306bINNER\u30ad\u30fc\u30ef\u30fc\u30c9\u304c\u5fc5\u9808\u3067\u306f\u306a\u3044\u306e\u3068\u540c\u69d8\u306b\u3001LEFT JOIN\u307e\u305f\u306fRIGHT JOIN\u3068\u8a18\u8ff0\u3059\u308b\u5834\u5408\u306f\u5e38\u306bOUTER\u304c\u6697\u9ed9\u7684\u306b\u6307\u5b9a\u3055\u308c\u307e\u3059\u3002.<\/p>\n<p>\u3053\u306e\u30af\u30a8\u30ea\u306e\u7d50\u679c\u306f\u524d\u306e\u30af\u30a8\u30ea\u3068\u306f\u9006\u3067\u3001\u4e21\u65b9\u306e\u30c6\u30fc\u30d6\u30eb\u306e\u3059\u3079\u3066\u306e\u884c\u3092\u8fd4\u3057\u307e\u3059\u304c\u3001\u300c\u53f3\u5074\u300d\u306e\u30c6\u30fc\u30d6\u30eb\u304b\u3089\u306f\u4e00\u610f\u306e\u884c\u306e\u307f\u304c\u8fd4\u3055\u308c\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code>Output\r\n+--------+----------+-------------+----------+\r\n| saleID | quantity | salesperson | empName |\r\n+--------+----------+-------------+----------+\r\n| 1 | 7 | 1 | Florence |\r\n| NULL | NULL | NULL | Mary |\r\n| 4 | 1 | 3 | Diana |\r\n| 5 | 5 | 3 | Diana |\r\n| 2 | 10 | 4 | Betty |\r\n| 3 | 8 | 4 | Betty |\r\n+--------+----------+-------------+----------+\r\n6 rows in set (0.00 sec)<\/code><\/pre>\n<\/div>\n<\/div>\n<div>\n<p>JOIN\u53e5\u306e\u30c6\u30fc\u30d6\u30eb\u3068\u5217\u306e\u5225\u540d<\/p>\n<p>\u9577\u3044\u540d\u524d\u3084\u975e\u5e38\u306b\u8aac\u660e\u7684\u306a\u540d\u524d\u3092\u6301\u3064\u30c6\u30fc\u30d6\u30eb\u3092\u7d50\u5408\u3059\u308b\u5834\u5408\u3001\u8907\u6570\u306e\u5b8c\u5168\u4fee\u98fe\u5217\u53c2\u7167\u3092\u8a18\u8ff0\u3059\u308b\u306e\u306f\u9762\u5012\u3067\u3059\u3002\u3053\u308c\u3092\u56de\u907f\u3059\u308b\u306b\u306f\u3001\u30c6\u30fc\u30d6\u30eb\u540d\u307e\u305f\u306f\u5217\u540d\u306b\u77ed\u3044\u30a8\u30a4\u30ea\u30a2\u30b9\u3092\u6307\u5b9a\u3059\u308b\u3068\u4fbf\u5229\u3067\u3059\u3002.<\/p>\n<p>SQL \u3067\u3053\u308c\u3092\u884c\u3046\u306b\u306f\u3001FROM \u53e5\u306e\u5404\u30c6\u30fc\u30d6\u30eb\u5b9a\u7fa9\u306e\u5f8c\u306b AS \u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u7d9a\u3051\u3001\u305d\u306e\u5f8c\u306b\u4efb\u610f\u306e\u30a8\u30a4\u30ea\u30a2\u30b9\u3092\u7d9a\u3051\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-sql\" data-lang=\"SQL\"><code>SELECT t1.column1, t2.column2\r\nFROM table1 AS t1 JOIN table2 AS t2\r\nON t1.related_column = t2.related_column;<\/code><\/pre>\n<\/div>\n<\/div>\n<div>\n<p>\u3053\u306e\u4f8b\u306e\u69cb\u6587\u3067\u306f\u3001SELECT \u53e5\u3067\u30a8\u30a4\u30ea\u30a2\u30b9\u3092\u4f7f\u7528\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u30a8\u30a4\u30ea\u30a2\u30b9\u306f FROM \u53e5\u306e\u524d\u306b\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002\u3053\u308c\u306f\u3001SQL \u30af\u30a8\u30ea\u3067\u306f\u5b9f\u884c\u9806\u5e8f\u304c FROM \u53e5\u304b\u3089\u59cb\u307e\u308b\u305f\u3081\u3067\u3059\u3002\u3053\u308c\u306f\u6df7\u4e71\u3092\u62db\u304f\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u304c\u3001\u30af\u30a8\u30ea\u306e\u4f5c\u6210\u3092\u59cb\u3081\u308b\u524d\u306b\u3001\u3053\u306e\u3053\u3068\u3092\u899a\u3048\u3066\u304a\u3044\u3066\u30a8\u30a4\u30ea\u30a2\u30b9\u306b\u3064\u3044\u3066\u8003\u3048\u3066\u304a\u304f\u3068\u4fbf\u5229\u3067\u3059\u3002.<\/p>\n<p>\u305f\u3068\u3048\u3070\u3001Sales \u30c6\u30fc\u30d6\u30eb\u3068 Products \u30c6\u30fc\u30d6\u30eb\u3092\u7d50\u5408\u3057\u3001\u305d\u308c\u305e\u308c\u306b\u5225\u540d S \u3068 P \u3092\u6307\u5b9a\u3059\u308b\u6b21\u306e\u30af\u30a8\u30ea\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-sql\" data-lang=\"SQL\"><code>SELECT S.saleID, S.quantity,\r\nP.productName,\r\n(P.price * S.quantity) AS revenue \r\nFROM sales AS S JOIN products AS P\r\nUSING (productID);<\/code><\/pre>\n<\/div>\n<\/div>\n<div>\u3053\u306e\u4f8b\u3067\u306f\u3001Sales\u30c6\u30fc\u30d6\u30eb\u306eAmount\u5217\u306e\u5024\u3068Products\u30c6\u30fc\u30d6\u30eb\u306ePrice\u5217\u306e\u5bfe\u5fdc\u3059\u308b\u5024\u306e\u7a4d\u306b\u30013\u3064\u76ee\u306e\u30a8\u30a4\u30ea\u30a2\u30b9\u300cRevenue\u300d\u304c\u4f5c\u6210\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u306b\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u308c\u306f\u7d50\u679c\u30bb\u30c3\u30c8\u306e\u5217\u540d\u304b\u3089\u306e\u307f\u660e\u3089\u304b\u3067\u3059\u304c\u3001\u3053\u306e\u3088\u3046\u306a\u30a8\u30a4\u30ea\u30a2\u30b9\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067\u3001\u30af\u30a8\u30ea\u7d50\u679c\u306e\u610f\u5473\u3084\u610f\u56f3\u3092\u4f1d\u3048\u308b\u306e\u306b\u5f79\u7acb\u3061\u307e\u3059\u3002<\/div>\n<div>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code>Output\r\n+--------+----------+-------------+---------+\r\n| saleID | quantity | productName | revenue |\r\n+--------+----------+-------------+---------+\r\n| 1 | 7 | widget | 132.93 |\r\n| 2 | 10 | whatzit | 299.90 |\r\n| 3 | 8 | gizmo | 115.92 |\r\n| 4 | 1 | thingamajig | 39.99 |\r\n| 5 | 5 | widget | 94.95 |\r\n| 6 | 1 | whatzit | 29.99 |\r\n| 7 | 3 | widget | 56.97 |\r\n| 8 | 4 | whatzit | 119.96 |\r\n+--------+----------+-------------+---------+\r\n8 rows in set (0.00 sec)<\/code><\/pre>\n<\/div>\n<\/div>\n<div>\u30a8\u30a4\u30ea\u30a2\u30b9\u3092\u5b9a\u7fa9\u3059\u308b\u969b\u3001AS \u30ad\u30fc\u30ef\u30fc\u30c9\u306f\u6280\u8853\u7684\u306b\u306f\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u3042\u308b\u3053\u3068\u306b\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u524d\u306e\u4f8b\u306f\u6b21\u306e\u3088\u3046\u306b\u3082\u8a18\u8ff0\u3067\u304d\u307e\u3059\u3002<\/div>\n<div>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-sql\" data-lang=\"SQL\"><code>SELECT S.saleID, S.quantity, P.productName, (P.price * S.quantity) revenue \r\nFROM sales S JOIN products P\r\nUSING (productID);<\/code><\/pre>\n<\/div>\n<\/div>\n<div>\n<p>AS \u30ad\u30fc\u30ef\u30fc\u30c9\u306f\u30a8\u30a4\u30ea\u30a2\u30b9\u306e\u5b9a\u7fa9\u306b\u5fc5\u9808\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u304c\u3001\u542b\u3081\u308b\u3053\u3068\u304c\u63a8\u5968\u3055\u308c\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30af\u30a8\u30ea\u306e\u610f\u56f3\u304c\u660e\u78ba\u306b\u306a\u308a\u3001\u8aad\u307f\u3084\u3059\u3055\u304c\u5411\u4e0a\u3057\u307e\u3059\u3002.<\/p>\n<h2 id=\"%d9%86%d8%aa%db%8c%d8%ac%d9%87\">\u7d50\u679c<\/h2>\n<p>\u3053\u306e\u30ac\u30a4\u30c9\u3067\u306f\u3001JOIN\u64cd\u4f5c\u3092\u4f7f\u7528\u3057\u3066\u8907\u6570\u306e\u30c6\u30fc\u30d6\u30eb\u30921\u3064\u306e\u30af\u30a8\u30ea\u7d50\u679c\u30bb\u30c3\u30c8\u306b\u7d50\u5408\u3059\u308b\u65b9\u6cd5\u3092\u5b66\u7fd2\u3057\u307e\u3057\u305f\u3002\u3053\u3053\u3067\u7d39\u4ecb\u3059\u308b\u30b3\u30de\u30f3\u30c9\u306f\u307b\u3068\u3093\u3069\u306e\u30ea\u30ec\u30fc\u30b7\u30e7\u30ca\u30eb\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3067\u52d5\u4f5c\u3057\u307e\u3059\u304c\u3001SQL\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3054\u3068\u306b\u72ec\u81ea\u306e\u8a00\u8a9e\u5b9f\u88c5\u304c\u4f7f\u7528\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u306b\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u5404\u30b3\u30de\u30f3\u30c9\u3068\u305d\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u8a73\u7d30\u306b\u3064\u3044\u3066\u306f\u3001DBMS\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002.<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"\u306f\u3058\u3081\u306b \u591a\u304f\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u8a2d\u8a08\u3067\u306f\u3001\u7279\u5b9a\u306e\u30c7\u30fc\u30bf \u30dd\u30a4\u30f3\u30c8\u9593\u306e\u95a2\u4fc2\u306b\u57fa\u3065\u3044\u3066\u60c5\u5831\u3092\u30c6\u30fc\u30d6\u30eb\u306b\u6574\u7406\u3057\u307e\u3059\u3002","protected":false},"author":1,"featured_media":16027,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_yoast_wpseo_focuskw":"\u0646\u062d\u0648\u0647 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 Joins \u062f\u0631 SQL","_yoast_wpseo_title":"","_yoast_wpseo_metadesc":"","_yoast_wpseo_canonical":"","_yoast_wpseo_opengraph-description":"","_yoast_wpseo_opengraph-image":"","_yoast_wpseo_twitter-description":"","_yoast_wpseo_twitter-image":"","_yoast_wpseo_focuskeywords":"","_yoast_wpseo_primary_category":"193","footnotes":""},"categories":[193,349],"tags":[403,391],"class_list":{"0":"post-15949","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-tutorials","8":"category-database","9":"tag-data-base","10":"tag-mysql"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>\u0646\u062d\u0648\u0647 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 Joins \u062f\u0631 SQL - \u0628\u0644\u0627\u06af ITPiran<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.itpiran.net\/blog\/ja\/tutorials\/how-to-use-joins-in-sql\/\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u0646\u062d\u0648\u0647 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 Joins \u062f\u0631 SQL - \u0628\u0644\u0627\u06af ITPiran\" \/>\n<meta property=\"og:description\" content=\"\u0645\u0642\u062f\u0645\u0647 \u0628\u0633\u06cc\u0627\u0631\u06cc \u0627\u0632 \u0637\u0631\u0627\u062d\u06cc \u0647\u0627\u06cc \u067e\u0627\u06cc\u06af\u0627\u0647 \u062f\u0627\u062f\u0647 \u0628\u0631 \u0627\u0633\u0627\u0633 \u0631\u0648\u0627\u0628\u0637 \u0628\u06cc\u0646 \u0646\u0642\u0627\u0637 \u062f\u0627\u062f\u0647 \u062e\u0627\u0635\u060c \u0627\u0637\u0644\u0627\u0639\u0627\u062a \u0631\u0627 \u0628\u0647 \u062c\u062f\u0627\u0648\u0644&hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.itpiran.net\/blog\/ja\/tutorials\/how-to-use-joins-in-sql\/\" \/>\n<meta property=\"og:site_name\" content=\"\u0628\u0644\u0627\u06af ITPiran\" \/>\n<meta property=\"article:published_time\" content=\"2024-07-22T17:56:37+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-08-14T17:02:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.itpiran.net\/2024\/07\/14203156\/joins-sql.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1793\" \/>\n\t<meta property=\"og:image:height\" content=\"1110\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u57f7\u7b46\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"4\u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/tutorials\\\/how-to-use-joins-in-sql\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/tutorials\\\/how-to-use-joins-in-sql\\\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/#\\\/schema\\\/person\\\/04ed27b919baca468a2273f8e4318f81\"},\"headline\":\"\u0646\u062d\u0648\u0647 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 Joins \u062f\u0631 SQL\",\"datePublished\":\"2024-07-22T17:56:37+00:00\",\"dateModified\":\"2024-08-14T17:02:31+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/tutorials\\\/how-to-use-joins-in-sql\\\/\"},\"wordCount\":213,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/tutorials\\\/how-to-use-joins-in-sql\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/cdn.itpiran.net\\\/2024\\\/07\\\/14203156\\\/joins-sql.jpg\",\"keywords\":[\"data base\",\"MySQL\"],\"articleSection\":[\"\u0622\u0645\u0648\u0632\u0634\u06cc\",\"\u067e\u0627\u06cc\u06af\u0627\u0647 \u062f\u0627\u062f\u0647\"],\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/tutorials\\\/how-to-use-joins-in-sql\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/tutorials\\\/how-to-use-joins-in-sql\\\/\",\"url\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/tutorials\\\/how-to-use-joins-in-sql\\\/\",\"name\":\"\u0646\u062d\u0648\u0647 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 Joins \u062f\u0631 SQL - \u0628\u0644\u0627\u06af ITPiran\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/tutorials\\\/how-to-use-joins-in-sql\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/tutorials\\\/how-to-use-joins-in-sql\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/cdn.itpiran.net\\\/2024\\\/07\\\/14203156\\\/joins-sql.jpg\",\"datePublished\":\"2024-07-22T17:56:37+00:00\",\"dateModified\":\"2024-08-14T17:02:31+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/tutorials\\\/how-to-use-joins-in-sql\\\/#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/tutorials\\\/how-to-use-joins-in-sql\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/tutorials\\\/how-to-use-joins-in-sql\\\/#primaryimage\",\"url\":\"https:\\\/\\\/cdn.itpiran.net\\\/2024\\\/07\\\/14203156\\\/joins-sql.jpg\",\"contentUrl\":\"https:\\\/\\\/cdn.itpiran.net\\\/2024\\\/07\\\/14203156\\\/joins-sql.jpg\",\"width\":1793,\"height\":1110},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/tutorials\\\/how-to-use-joins-in-sql\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u0622\u0645\u0648\u0632\u0634\u06cc\",\"item\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/category\\\/tutorials\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"\u0646\u062d\u0648\u0647 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 Joins \u062f\u0631 SQL\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/\",\"name\":\"\u0628\u0644\u0627\u06af ITPiran\",\"description\":\"\u0627\u062e\u0628\u0627\u0631 \u0648 \u0645\u0642\u0627\u0644\u0627\u062a \u062a\u062c\u0627\u0631\u062a \u067e\u0627\u06cc\u062f\u0627\u0631 \u0627\u06cc\u0631\u0627\u0646\u06cc\u0627\u0646\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ja\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/#organization\",\"name\":\"\u0628\u0644\u0627\u06af \u062a\u062c\u0627\u0631\u062a \u067e\u0627\u06cc\u062f\u0627\u0631 \u0627\u06cc\u0631\u0627\u0646\u06cc\u0627\u0646\",\"alternateName\":\"ITPIran Blog\",\"url\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/cdn.itpiran.net\\\/2023\\\/12\\\/27150508\\\/cropped-ITPIRAN-BLOG-LOGO-2.png\",\"contentUrl\":\"https:\\\/\\\/cdn.itpiran.net\\\/2023\\\/12\\\/27150508\\\/cropped-ITPIRAN-BLOG-LOGO-2.png\",\"width\":512,\"height\":512,\"caption\":\"\u0628\u0644\u0627\u06af \u062a\u062c\u0627\u0631\u062a \u067e\u0627\u06cc\u062f\u0627\u0631 \u0627\u06cc\u0631\u0627\u0646\u06cc\u0627\u0646\"},\"image\":{\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/#\\\/schema\\\/person\\\/04ed27b919baca468a2273f8e4318f81\",\"name\":\"admin\",\"url\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/ja\\\/author\\\/admin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SQL\u3067\u7d50\u5408\u3092\u4f7f\u7528\u3059\u308b\u65b9\u6cd5 - ITPiran\u30d6\u30ed\u30b0","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.itpiran.net\/blog\/ja\/tutorials\/how-to-use-joins-in-sql\/","og_locale":"ja_JP","og_type":"article","og_title":"\u0646\u062d\u0648\u0647 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 Joins \u062f\u0631 SQL - \u0628\u0644\u0627\u06af ITPiran","og_description":"\u0645\u0642\u062f\u0645\u0647 \u0628\u0633\u06cc\u0627\u0631\u06cc \u0627\u0632 \u0637\u0631\u0627\u062d\u06cc \u0647\u0627\u06cc \u067e\u0627\u06cc\u06af\u0627\u0647 \u062f\u0627\u062f\u0647 \u0628\u0631 \u0627\u0633\u0627\u0633 \u0631\u0648\u0627\u0628\u0637 \u0628\u06cc\u0646 \u0646\u0642\u0627\u0637 \u062f\u0627\u062f\u0647 \u062e\u0627\u0635\u060c \u0627\u0637\u0644\u0627\u0639\u0627\u062a \u0631\u0627 \u0628\u0647 \u062c\u062f\u0627\u0648\u0644&hellip;","og_url":"https:\/\/www.itpiran.net\/blog\/ja\/tutorials\/how-to-use-joins-in-sql\/","og_site_name":"\u0628\u0644\u0627\u06af ITPiran","article_published_time":"2024-07-22T17:56:37+00:00","article_modified_time":"2024-08-14T17:02:31+00:00","og_image":[{"width":1793,"height":1110,"url":"https:\/\/cdn.itpiran.net\/2024\/07\/14203156\/joins-sql.jpg","type":"image\/jpeg"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u57f7\u7b46\u8005":"admin","\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593":"4\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.itpiran.net\/blog\/tutorials\/how-to-use-joins-in-sql\/#article","isPartOf":{"@id":"https:\/\/www.itpiran.net\/blog\/tutorials\/how-to-use-joins-in-sql\/"},"author":{"name":"admin","@id":"https:\/\/www.itpiran.net\/blog\/#\/schema\/person\/04ed27b919baca468a2273f8e4318f81"},"headline":"\u0646\u062d\u0648\u0647 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 Joins \u062f\u0631 SQL","datePublished":"2024-07-22T17:56:37+00:00","dateModified":"2024-08-14T17:02:31+00:00","mainEntityOfPage":{"@id":"https:\/\/www.itpiran.net\/blog\/tutorials\/how-to-use-joins-in-sql\/"},"wordCount":213,"commentCount":0,"publisher":{"@id":"https:\/\/www.itpiran.net\/blog\/#organization"},"image":{"@id":"https:\/\/www.itpiran.net\/blog\/tutorials\/how-to-use-joins-in-sql\/#primaryimage"},"thumbnailUrl":"https:\/\/cdn.itpiran.net\/2024\/07\/14203156\/joins-sql.jpg","keywords":["data base","MySQL"],"articleSection":["\u0622\u0645\u0648\u0632\u0634\u06cc","\u067e\u0627\u06cc\u06af\u0627\u0647 \u062f\u0627\u062f\u0647"],"inLanguage":"ja","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.itpiran.net\/blog\/tutorials\/how-to-use-joins-in-sql\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.itpiran.net\/blog\/tutorials\/how-to-use-joins-in-sql\/","url":"https:\/\/www.itpiran.net\/blog\/tutorials\/how-to-use-joins-in-sql\/","name":"SQL\u3067\u7d50\u5408\u3092\u4f7f\u7528\u3059\u308b\u65b9\u6cd5 - ITPiran\u30d6\u30ed\u30b0","isPartOf":{"@id":"https:\/\/www.itpiran.net\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.itpiran.net\/blog\/tutorials\/how-to-use-joins-in-sql\/#primaryimage"},"image":{"@id":"https:\/\/www.itpiran.net\/blog\/tutorials\/how-to-use-joins-in-sql\/#primaryimage"},"thumbnailUrl":"https:\/\/cdn.itpiran.net\/2024\/07\/14203156\/joins-sql.jpg","datePublished":"2024-07-22T17:56:37+00:00","dateModified":"2024-08-14T17:02:31+00:00","breadcrumb":{"@id":"https:\/\/www.itpiran.net\/blog\/tutorials\/how-to-use-joins-in-sql\/#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.itpiran.net\/blog\/tutorials\/how-to-use-joins-in-sql\/"]}]},{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.itpiran.net\/blog\/tutorials\/how-to-use-joins-in-sql\/#primaryimage","url":"https:\/\/cdn.itpiran.net\/2024\/07\/14203156\/joins-sql.jpg","contentUrl":"https:\/\/cdn.itpiran.net\/2024\/07\/14203156\/joins-sql.jpg","width":1793,"height":1110},{"@type":"BreadcrumbList","@id":"https:\/\/www.itpiran.net\/blog\/tutorials\/how-to-use-joins-in-sql\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.itpiran.net\/blog\/"},{"@type":"ListItem","position":2,"name":"\u0622\u0645\u0648\u0632\u0634\u06cc","item":"https:\/\/www.itpiran.net\/blog\/category\/tutorials\/"},{"@type":"ListItem","position":3,"name":"\u0646\u062d\u0648\u0647 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 Joins \u062f\u0631 SQL"}]},{"@type":"WebSite","@id":"https:\/\/www.itpiran.net\/blog\/#website","url":"https:\/\/www.itpiran.net\/blog\/","name":"ITPiran\u30d6\u30ed\u30b0","description":"\u30a4\u30e9\u30f3\u306e\u6301\u7d9a\u53ef\u80fd\u306a\u8cbf\u6613\u306b\u95a2\u3059\u308b\u30cb\u30e5\u30fc\u30b9\u3068\u8a18\u4e8b","publisher":{"@id":"https:\/\/www.itpiran.net\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.itpiran.net\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ja"},{"@type":"Organization","@id":"https:\/\/www.itpiran.net\/blog\/#organization","name":"\u6301\u7d9a\u53ef\u80fd\u306a\u30a4\u30e9\u30f3\u30d3\u30b8\u30cd\u30b9\u30d6\u30ed\u30b0","alternateName":"ITPIran Blog","url":"https:\/\/www.itpiran.net\/blog\/","logo":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.itpiran.net\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdn.itpiran.net\/2023\/12\/27150508\/cropped-ITPIRAN-BLOG-LOGO-2.png","contentUrl":"https:\/\/cdn.itpiran.net\/2023\/12\/27150508\/cropped-ITPIRAN-BLOG-LOGO-2.png","width":512,"height":512,"caption":"\u0628\u0644\u0627\u06af \u062a\u062c\u0627\u0631\u062a \u067e\u0627\u06cc\u062f\u0627\u0631 \u0627\u06cc\u0631\u0627\u0646\u06cc\u0627\u0646"},"image":{"@id":"https:\/\/www.itpiran.net\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.itpiran.net\/blog\/#\/schema\/person\/04ed27b919baca468a2273f8e4318f81","name":"\u7ba1\u7406\u8005","url":"https:\/\/www.itpiran.net\/blog\/ja\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.itpiran.net\/blog\/ja\/wp-json\/wp\/v2\/posts\/15949","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itpiran.net\/blog\/ja\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itpiran.net\/blog\/ja\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itpiran.net\/blog\/ja\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itpiran.net\/blog\/ja\/wp-json\/wp\/v2\/comments?post=15949"}],"version-history":[{"count":4,"href":"https:\/\/www.itpiran.net\/blog\/ja\/wp-json\/wp\/v2\/posts\/15949\/revisions"}],"predecessor-version":[{"id":16028,"href":"https:\/\/www.itpiran.net\/blog\/ja\/wp-json\/wp\/v2\/posts\/15949\/revisions\/16028"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.itpiran.net\/blog\/ja\/wp-json\/wp\/v2\/media\/16027"}],"wp:attachment":[{"href":"https:\/\/www.itpiran.net\/blog\/ja\/wp-json\/wp\/v2\/media?parent=15949"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itpiran.net\/blog\/ja\/wp-json\/wp\/v2\/categories?post=15949"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itpiran.net\/blog\/ja\/wp-json\/wp\/v2\/tags?post=15949"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}