{"id":623,"date":"2024-07-08T19:16:16","date_gmt":"2024-07-08T16:16:16","guid":{"rendered":"https:\/\/road-to-heaven.viro35.ru\/?page_id=623"},"modified":"2025-01-14T09:14:40","modified_gmt":"2025-01-14T06:14:40","slug":"%d0%bf%d1%80%d0%b8%d1%81%d0%be%d0%b5%d0%b4%d0%b8%d0%bd%d0%b5%d0%bd%d0%b8%d0%b5-%d1%82%d0%b0%d0%b1%d0%bb%d0%b8%d1%86","status":"publish","type":"page","link":"https:\/\/road-to-heaven.viro35.ru\/?page_id=623","title":{"rendered":"JOIN &#8212; \u041f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446"},"content":{"rendered":"\n<p><strong>JOIN<\/strong> &#8212; \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a \u0438\u0437 \u0434\u0432\u0443\u0445 \u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u0442\u0430\u0431\u043b\u0438\u0446 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u0430.<\/p>\n\n\n\n<p><strong>(INNER) JOIN<\/strong>: \u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u043f\u0430\u0440\u044b \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0442\u0430\u0431\u043b\u0438\u0446, \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0438\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u0443\u044f \u043d\u043e\u0432\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e \u043f\u043e\u043b\u044f \u0438\u0437 \u043f\u0435\u0440\u0432\u043e\u0439 \u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"SELECT ProductID, ProductName, CategoryName\nFROM Products\nINNER JOIN Categories ON Products.CategoryID = Categories.CategoryID;\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">SELECT<\/span><span style=\"color: #D4D4D4\"> ProductID, ProductName, CategoryName<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">FROM<\/span><span style=\"color: #D4D4D4\"> Products<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">INNER JOIN<\/span><span style=\"color: #D4D4D4\"> Categories <\/span><span style=\"color: #569CD6\">ON<\/span><span style=\"color: #D4D4D4\"> Products.CategoryID = Categories.CategoryID;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><strong>LEFT (OUTER) JOIN:<\/strong> \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0432\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u0437 \u043b\u0435\u0432\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u0437 \u043f\u0440\u0430\u0432\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"SELECT column_name(s)\nFROM table1\nLEFT JOIN table2\nON table1.column_name = table2.column_name;\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">SELECT<\/span><span style=\"color: #D4D4D4\"> column_name(s)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">FROM<\/span><span style=\"color: #D4D4D4\"> table1<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">LEFT JOIN<\/span><span style=\"color: #D4D4D4\"> table2<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">ON<\/span><span style=\"color: #D4D4D4\"> table1.column_name = table2.column_name;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"-- \u0435\u0441\u043b\u0438 \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u043f\u0440\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0438 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0438 null \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\nSelect first_name,last_name, \ncount(COALESCE(Schedule.id)) as amount_classes \nfrom teacher\nleft join Schedule ON Teacher.id = Schedule.teacher\nGROUP BY teacher.id\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #6A9955\">-- \u0435\u0441\u043b\u0438 \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u043f\u0440\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0438 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0438 null \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">Select<\/span><span style=\"color: #D4D4D4\"> first_name,last_name, <\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">count<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #DCDCAA\">COALESCE<\/span><span style=\"color: #D4D4D4\">(Schedule.id)) <\/span><span style=\"color: #569CD6\">as<\/span><span style=\"color: #D4D4D4\"> amount_classes <\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">from<\/span><span style=\"color: #D4D4D4\"> teacher<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">left join<\/span><span style=\"color: #D4D4D4\"> Schedule <\/span><span style=\"color: #569CD6\">ON<\/span><span style=\"color: #D4D4D4\"> Teacher.id = Schedule.teacher<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">GROUP BY<\/span><span style=\"color: #D4D4D4\"> teacher.id<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><strong>RIGHT (OUTER) JOIN:<\/strong> \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0432\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u0437 \u043f\u0440\u0430\u0432\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u0437 \u043b\u0435\u0432\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"SELECT column_name(s)\nFROM table1\nRIGHT JOIN table2\nON table1.column_name = table2.column_name;\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">SELECT<\/span><span style=\"color: #D4D4D4\"> column_name(s)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">FROM<\/span><span style=\"color: #D4D4D4\"> table1<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">RIGHT JOIN<\/span><span style=\"color: #D4D4D4\"> table2<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">ON<\/span><span style=\"color: #D4D4D4\"> table1.column_name = table2.column_name;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><strong>FULL (OUTER) JOIN:<\/strong> \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0432\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438, \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0435 \u0432 \u043b\u0435\u0432\u043e\u0439 \u0438\u043b\u0438 \u043f\u0440\u0430\u0432\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"SELECT column_name(s)\nFROM table1\nFULL OUTER JOIN table2\nON table1.column_name = table2.column_name\nWHERE condition;\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">SELECT<\/span><span style=\"color: #D4D4D4\"> column_name(s)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">FROM<\/span><span style=\"color: #D4D4D4\"> table1<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">FULL OUTER JOIN<\/span><span style=\"color: #D4D4D4\"> table2<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">ON<\/span><span style=\"color: #D4D4D4\"> table1.column_name = table2.column_name<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">WHERE<\/span><span style=\"color: #D4D4D4\"> condition;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><strong>SELF JOIN<\/strong> &#8212; \u044d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u043e\u0435 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435, \u043d\u043e \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u0430 \u0441 \u0441\u043e\u0431\u043e\u0439<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"SELECT A.CustomerName AS CustomerName1, B.CustomerName AS CustomerName2, A.City\nFROM Customers A, Customers B\nWHERE A.CustomerID <&gt; B.CustomerID\nAND A.City = B.City\nORDER BY A.City;\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">SELECT<\/span><span style=\"color: #D4D4D4\"> A.CustomerName <\/span><span style=\"color: #569CD6\">AS<\/span><span style=\"color: #D4D4D4\"> CustomerName1, B.CustomerName <\/span><span style=\"color: #569CD6\">AS<\/span><span style=\"color: #D4D4D4\"> CustomerName2, A.City<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">FROM<\/span><span style=\"color: #D4D4D4\"> Customers A, Customers B<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">WHERE<\/span><span style=\"color: #D4D4D4\"> A.CustomerID &lt;&gt; B.CustomerID<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">AND<\/span><span style=\"color: #D4D4D4\"> A.City = B.City<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">ORDER BY<\/span><span style=\"color: #D4D4D4\"> A.City;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u0421\u0445\u0435\u043c\u0430<\/th><th>\u0417\u0430\u043f\u0440\u043e\u0441 \u0441 JOIN<\/th><\/tr><\/thead><tbody><tr><td><img decoding=\"async\" src=\"https:\/\/sql-academy.org\/static\/guidePage\/multi-table-request-join\/left.svg\" width=\"100\"><\/td><td>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u043b\u0435\u0432\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0441\u043e\u0435\u0434\u0438\u043d\u0451\u043d\u043d\u044b\u0445 \u0441 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0437 \u043f\u0440\u0430\u0432\u043e\u0439:MySQLSELECT \u043f\u043e\u043b\u044f_\u0442\u0430\u0431\u043b\u0438\u0446 FROM \u043b\u0435\u0432\u0430\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u0430 LEFT JOIN \u043f\u0440\u0430\u0432\u0430\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u0430 ON \u043f\u0440\u0430\u0432\u0430\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u0430.\u043a\u043b\u044e\u0447 = \u043b\u0435\u0432\u0430\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u0430.\u043a\u043b\u044e\u0447<\/td><\/tr><tr><td><img decoding=\"async\" src=\"https:\/\/sql-academy.org\/static\/guidePage\/multi-table-request-join\/right.svg\"><\/td><td>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u043f\u0440\u0430\u0432\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0441\u043e\u0435\u0434\u0438\u043d\u0451\u043d\u043d\u044b\u0445 \u0441 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0437 \u043b\u0435\u0432\u043e\u0439:MySQLSELECT \u043f\u043e\u043b\u044f_\u0442\u0430\u0431\u043b\u0438\u0446 FROM \u043b\u0435\u0432\u0430\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u0430 RIGHT JOIN \u043f\u0440\u0430\u0432\u0430\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u0430 ON \u043f\u0440\u0430\u0432\u0430\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u0430.\u043a\u043b\u044e\u0447 = \u043b\u0435\u0432\u0430\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u0430.\u043a\u043b\u044e\u0447<\/td><\/tr><tr><td><img decoding=\"async\" src=\"https:\/\/sql-academy.org\/static\/guidePage\/multi-table-request-join\/left_no_right.svg\"><\/td><td>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0445\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043a \u043b\u0435\u0432\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435:MySQLSELECT \u043f\u043e\u043b\u044f_\u0442\u0430\u0431\u043b\u0438\u0446 FROM \u043b\u0435\u0432\u0430\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u0430 LEFT JOIN \u043f\u0440\u0430\u0432\u0430\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u0430 ON \u043f\u0440\u0430\u0432\u0430\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u0430.\u043a\u043b\u044e\u0447 = \u043b\u0435\u0432\u0430\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u0430.\u043a\u043b\u044e\u0447 WHERE \u043f\u0440\u0430\u0432\u0430\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u0430.\u043a\u043b\u044e\u0447 IS NULL<\/td><\/tr><tr><td><img decoding=\"async\" src=\"https:\/\/sql-academy.org\/static\/guidePage\/multi-table-request-join\/right_no_left.svg\"><\/td><td>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0445\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043a \u043f\u0440\u0430\u0432\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435:MySQLSELECT \u043f\u043e\u043b\u044f_\u0442\u0430\u0431\u043b\u0438\u0446 FROM \u043b\u0435\u0432\u0430\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u0430 RIGHT JOIN \u043f\u0440\u0430\u0432\u0430\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u0430 ON \u043f\u0440\u0430\u0432\u0430\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u0430.\u043a\u043b\u044e\u0447 = \u043b\u0435\u0432\u0430\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u0430.\u043a\u043b\u044e\u0447 WHERE \u043b\u0435\u0432\u0430\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u0430.\u043a\u043b\u044e\u0447 IS NULL<\/td><\/tr><tr><td><img decoding=\"async\" src=\"https:\/\/sql-academy.org\/static\/guidePage\/multi-table-request-join\/right_and_left.svg\"><\/td><td>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0445\u0441\u044f \u043a\u0430\u043a \u043a \u043b\u0435\u0432\u043e\u0439, \u0442\u0430\u043a \u0438 \u043a \u043f\u0440\u0430\u0432\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435:MySQLSELECT \u043f\u043e\u043b\u044f_\u0442\u0430\u0431\u043b\u0438\u0446 FROM \u043b\u0435\u0432\u0430\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u0430 INNER JOIN \u043f\u0440\u0430\u0432\u0430\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u0430 ON \u043f\u0440\u0430\u0432\u0430\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u0430.\u043a\u043b\u044e\u0447 = \u043b\u0435\u0432\u0430\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u0430.\u043a\u043b\u044e\u0447<\/td><\/tr><tr><td><img decoding=\"async\" src=\"https:\/\/sql-academy.org\/static\/guidePage\/multi-table-request-join\/all.svg\"><\/td><td>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0445\u0441\u044f \u043a \u043b\u0435\u0432\u043e\u0439 \u0438 \u043f\u0440\u0430\u0432\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u0445 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c\u0443 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044e:MySQLSELECT \u043f\u043e\u043b\u044f_\u0442\u0430\u0431\u043b\u0438\u0446 FROM \u043b\u0435\u0432\u0430\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u0430 FULL OUTER JOIN \u043f\u0440\u0430\u0432\u0430\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u0430 ON \u043f\u0440\u0430\u0432\u0430\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u0430.\u043a\u043b\u044e\u0447 = \u043b\u0435\u0432\u0430\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u0430.\u043a\u043b\u044e\u0447<\/td><\/tr><tr><td><img decoding=\"async\" src=\"https:\/\/sql-academy.org\/static\/guidePage\/multi-table-request-join\/right_xor_left.svg\"><\/td><td>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0445\u0441\u044f \u043a \u043b\u0435\u0432\u043e\u0439 \u0438 \u043f\u0440\u0430\u0432\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e (\u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0435 INNER JOIN):MySQLSELECT \u043f\u043e\u043b\u044f_\u0442\u0430\u0431\u043b\u0438\u0446 FROM \u043b\u0435\u0432\u0430\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u0430 FULL OUTER JOIN \u043f\u0440\u0430\u0432\u0430\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u0430 ON \u043f\u0440\u0430\u0432\u0430\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u0430.\u043a\u043b\u044e\u0447 = \u043b\u0435\u0432\u0430\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u0430.\u043a\u043b\u044e\u0447 WHERE \u043b\u0435\u0432\u0430\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u0430.\u043a\u043b\u044e\u0447 IS NULL OR \u043f\u0440\u0430\u0432\u0430\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u0430.\u043a\u043b\u044e\u0447 IS NULL<\/td><\/tr><\/tbody><\/table><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>JOIN &#8212; \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a \u0438\u0437 \u0434\u0432\u0443\u0445 \u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u0442\u0430\u0431\u043b\u0438\u0446 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u0430. (INNER) JOIN: \u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u043f\u0430\u0440\u044b \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0442\u0430\u0431\u043b\u0438\u0446, \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0438\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044e&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-623","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/road-to-heaven.viro35.ru\/index.php?rest_route=\/wp\/v2\/pages\/623","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/road-to-heaven.viro35.ru\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/road-to-heaven.viro35.ru\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/road-to-heaven.viro35.ru\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/road-to-heaven.viro35.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=623"}],"version-history":[{"count":23,"href":"https:\/\/road-to-heaven.viro35.ru\/index.php?rest_route=\/wp\/v2\/pages\/623\/revisions"}],"predecessor-version":[{"id":909,"href":"https:\/\/road-to-heaven.viro35.ru\/index.php?rest_route=\/wp\/v2\/pages\/623\/revisions\/909"}],"wp:attachment":[{"href":"https:\/\/road-to-heaven.viro35.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=623"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}