{"id":9101,"date":"2022-09-23T07:00:00","date_gmt":"2022-09-23T01:30:00","guid":{"rendered":"https:\/\/selfimagination.in\/tips\/?p=9101"},"modified":"2022-09-16T22:55:21","modified_gmt":"2022-09-16T17:25:21","slug":"mysql-join","status":"publish","type":"post","link":"https:\/\/selfimagination.in\/tips\/mysql-join\/","title":{"rendered":"MySQL Join"},"content":{"rendered":"\n<p>MySQL Join, MySQL Inner Join, Outer Join, Left Join, Right Join, Cross Join, Natural Join, Self Join \u0915\u0947 \u092c\u093e\u0930\u0947 \u092e\u0947 \u0938\u092e\u091d\u0947\u0902\u0917\u0947 \u0964 <\/p>\n\n\n\n<p>\u091c\u092c \u092d\u0940 \u0939\u092e\u0947 \u0926\u094b Table \u0915\u0947 \u0921\u093e\u091f\u093e \u0915\u094b \u0932\u093f\u0902\u0915 \u0915\u0930 Data \u0932\u093e\u0928\u093e \u0939\u094b\u0924\u093e \u0939\u0948\u0902 \u0924\u092c \u0939\u092e\u0947 Join Clause \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0928\u093e \u0939\u094b\u0924\u093e \u0939\u0948\u0902 \u0964 Table \u0915\u094b Join \u0915\u0930\u0928\u0947 \u0915\u0947 \u0932\u093f\u090f \u0915\u094b\u0908 \u090f\u0915 \u092f\u093e \u090f\u0915 \u0938\u0947 \u0905\u0927\u093f\u0915 Column \u0939\u094b\u0924\u0947 \u0939\u0948\u0902 \u091c\u093f\u0928\u0915\u0940 Base \u092a\u0930 \u0939\u092e \u0926\u094b Table \u0915\u094b Connect \u0915\u0930\u0924\u0947 \u0939\u0948\u0902 \u0964 \u0907\u0938 Article \u092e\u0947 \u0939\u092e Join \u0915\u093f\u0924\u0928\u0947 \u092a\u094d\u0930\u0915\u093e\u0930 \u0915\u0947 \u0939\u094b\u0924\u0947 \u0939\u0948\u0902 \u0924\u0925\u093e \u0939\u092e \u0909\u0928\u0915\u094b \u0909\u092a\u092f\u094b\u0917 \u0915\u0948\u0938\u0947 \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 \u0907\u0938\u0915\u0947 \u092c\u093e\u0930\u0947 \u092e\u0947 Example \u0938\u0939\u093f\u0924 \u0938\u0940\u0916\u0947\u0902\u0917\u0947 \u0964 <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">MySQL Join Types <\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"#inner-join\">1. Inner Join<\/a><\/li><li>2. Outer Join<ul><li><a href=\"http:\/\/left-join\" target=\"_blank\">2.1 Left Join<\/a><\/li><li><a href=\"#right-join\">2.2 Right Join<\/a><\/li><\/ul><\/li><li><a href=\"#cross-join\">3. Cross Join<\/a><\/li><li><a href=\"#natural-join\">4. Natural Join<\/a><\/li><li><a href=\"#self-join\">5. Self Join<\/a><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">MySQL Join Example<\/h2>\n\n\n\n<p>\u0939\u092e \u092f\u0939\u093e \u092a\u0930 \u0926\u094b \u091f\u0947\u092c\u0932 \u092c\u0928\u093e \u0930\u0939\u0947 \u0939\u0948\u0902, \u0914\u0930 \u0926\u094b\u0928\u094b\u0902 \u091f\u0947\u092c\u0932 \u0915\u094b \u0939\u092e \u0905\u0932\u0917-\u0905\u0932\u0917 join \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930 \u0909\u0938\u0915\u0947 Output \u0915\u094b \u0926\u0947\u0916\u0947\u0902\u0917\u0947 \u0914\u0930 \u0938\u0940\u0916\u0947\u0902\u0917\u0947 \u0915\u0940 Join \u0915\u093f\u0938 \u0924\u0930\u0939 \u0938\u0947 \u0915\u093e\u092e \u0915\u0930\u0924\u0947 \u0939\u0948\u0902 \u0964 <\/p>\n\n\n\n<p>Example \u092e\u0947 \u092a\u0939\u0932\u0940 \u091f\u0947\u092c\u0932 City Master \u0939\u0948\u0902, \u0926\u0942\u0938\u0930\u0940 Table State \u092e\u093e\u0938\u094d\u091f\u0930 \u0939\u0948\u0902 \u0964 \u0906\u092a \u0928\u093f\u092e\u094d\u0928 Command \u0938\u0947 \u0926\u094b\u0928\u094b\u0902 Tables \u092c\u0928\u093e \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 \u0964 <\/p>\n\n\n\n<p><a href=\"https:\/\/play.google.com\/store\/apps\/details?id=com.sl.SQL_Logic\" target=\"_blank\" rel=\"noopener\">MySQL \u0915\u094b \u0936\u0941\u0930\u0941\u0906\u0924 \u0938\u0947 \u0938\u0940\u0916\u0928\u0947 \u0915\u0947 \u0932\u093f\u090f SQL Logic Android App Free \u092e\u0947 Download \u0915\u0930\u0947 \u0964<\/a> <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">CREATE TABLE `citymst` (\n `city_id` int(5) NOT NULL AUTO_INCREMENT,\n `city_nm` varchar(20) NOT NULL,\n `state_id` int(5) NOT NULL,\n PRIMARY KEY (`city_id`)\n) ;\n\nCREATE TABLE `statemst` (\n `state_id` int(5) NOT NULL AUTO_INCREMENT,\n `state_nm` varchar(20) NOT NULL,\n PRIMARY KEY (`state_id`)\n) ;\n<\/code><\/pre>\n\n\n\n<p>Table \u092e\u0947 Data Enter \u0915\u0930\u0928\u0947 \u0915\u0947 \u0932\u093f\u090f \u0906\u092a \u0928\u093f\u092e\u094d\u0928 SQL \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0947 \u0964 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">INSERT INTO `citymst` (`city_id`, `city_nm`, `state_id`) VALUES \n(1, 'Indore', '1'), (2, 'Ujjain', '1'), (3, 'Bhopal', '1'), \n(4, 'Mumbai', '2'), (5, 'Varanasi', '3');\n\nINSERT INTO `statemst`(`state_id`, `state_nm`) VALUES (1,'MP'), (2, 'MH'), (4, 'RJ');\n<\/code><\/pre>\n\n\n\n<p>\u0909\u092a\u0930\u094b\u0915\u094d\u0924 Data Table \u092e\u0947 Insert \u0939\u094b\u0928\u0947 \u0915\u0947 \u092c\u093e\u0926 \u0915\u0941\u091b \u0907\u0938 \u0924\u0930\u0939 \u0938\u0947 \u0926\u093f\u0916\u093e\u0908 \u0926\u0947\u0917\u093e, \u092f\u0926\u093f \u0906\u092a data \u0915\u094b \u0926\u0947\u0916\u0947\u0902\u0917\u0947 \u0924\u094b \u092a\u093e\u090f\u0902\u0917\u0947 \u0915\u0940 \u0907\u0938\u092e\u0947 Citymst Table \u092e\u0947 \u090f\u0915 Column \u0939\u0948\u0902 \u091c\u093f\u0938\u0915\u093e \u0928\u093e\u092e state_id \u0939\u0948\u0902 \u0909\u0938 Column \u0915\u094b \u0939\u092e\u0928\u0947 Statemst Table \u0915\u0947 state_id \u0938\u0947 \u0932\u093f\u0902\u0915 \u0915\u093f\u092f\u093e \u0939\u0948 , <\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u0938\u093e\u0925 \u092e\u0947 \u0939\u092e\u0928\u0947 Citymst \u092e\u0947 state_id \u092e\u0947 3 \u0915\u094b Statemst \u092e\u0947 \u0928\u0939\u0940\u0902 \u0930\u0916\u093e \u0939\u0948 , <\/li><li>\u0914\u0930 Statemst \u0915\u0947 state-id Column \u092e\u0947 4 \u0915\u094b Citymst Table \u0915\u0947 state_id \u092e\u0947 \u0928\u0939\u0940\u0902 \u0930\u0916\u093e \u0939\u0948\u0902 \u0964 \u0905\u092c \u0907\u0938\u0940 Example \u092a\u0930 \u0939\u092e \u0938\u092d\u0940 Join \u0938\u092e\u091d\u0947\u0902\u0917\u0947 \u0964 <\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"523\" height=\"222\" src=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-10.png?resize=523%2C222&#038;ssl=1\" alt=\"\" class=\"wp-image-9115\" srcset=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-10.png?w=523&amp;ssl=1 523w, https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-10.png?resize=300%2C127&amp;ssl=1 300w, https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-10.png?resize=150%2C64&amp;ssl=1 150w\" sizes=\"auto, (max-width: 523px) 100vw, 523px\" \/><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"inner-join\">1. INNER JOIN<\/h2>\n\n\n\n<p>\u091c\u092c \u092d\u0940 \u0926\u094b Tables \u0915\u094b \u0932\u093f\u0902\u0915 \u0915\u0930\u0924\u0947 \u0939\u0948\u0902 \u0914\u0930 \u091a\u093e\u0939\u0924\u0947 \u0939\u0948\u0902 \u0926\u094b\u0928\u094b\u0902 table \u092e\u0947 \u091c\u094b value match \u0939\u094b \u0935\u0939\u0940 \u0926\u093f\u0916\u093e\u0908 \u0926\u0947 \u0924\u092c \u0939\u092e Inner Join \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0924\u0947 \u0939\u0948\u0902 \u092f\u0939 \u090f\u0915 \u0924\u0930\u0939 \u0938\u0947 Equal Join \u0939\u0940 \u0939\u0948\u0902 \u0964 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">SELECT * FROM citymst a inner join statemst b on a.state_id = b.state_id order by city_id<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"275\" src=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-12.png?resize=640%2C275&#038;ssl=1\" alt=\"MySQL Inner Join\" class=\"wp-image-9126\" srcset=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-12.png?w=752&amp;ssl=1 752w, https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-12.png?resize=300%2C129&amp;ssl=1 300w, https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-12.png?resize=150%2C64&amp;ssl=1 150w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/figure>\n<\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"left-join\">2.1 LEFT JOIN<\/h2>\n\n\n\n<p>\u091c\u092c \u092d\u0940 \u0926\u094b Tables \u0915\u094b \u0932\u093f\u0902\u0915 \u0915\u0930\u0924\u0947 \u0939\u0948\u0902 \u0914\u0930 \u091a\u093e\u0939\u0924\u0947 \u0939\u0948\u0902 \u0914\u0930 Left \u0935\u093e\u0932\u0940 table \u0915\u093e \u0938\u092d\u0940 \u0921\u093e\u091f\u093e \u0926\u0947\u0916\u0928\u093e \u091a\u093e\u0939\u0924\u0947 \u0939\u0948\u0902 Right \u0935\u093e\u0932\u0940 Table \u0915\u0947 \u091c\u094b Record Match \u0939\u094b \u0935\u0939 \u0926\u093f\u0916\u0947 \u091c\u094b Match \u0928 \u0939\u094b \u0935\u0939 \u0928\u0939\u0940\u0902 \u0926\u093f\u0916\u093e\u0908 \u0926\u0947 \u0924\u092c \u0906\u092a Left Join \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 \u0964 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">SELECT * FROM citymst a left join statemst b on a.state_id = b.state_id <\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"260\" src=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-13.png?resize=640%2C260&#038;ssl=1\" alt=\"MySQL Left Join\" class=\"wp-image-9128\" srcset=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-13.png?w=827&amp;ssl=1 827w, https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-13.png?resize=300%2C122&amp;ssl=1 300w, https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-13.png?resize=768%2C312&amp;ssl=1 768w, https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-13.png?resize=150%2C61&amp;ssl=1 150w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/figure>\n<\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"right-join\">2.2 RIGHT JOIN<\/h2>\n\n\n\n<p>\u091c\u092c \u092d\u0940 \u0926\u094b Tables \u0915\u094b \u0932\u093f\u0902\u0915 \u0915\u0930\u0924\u0947 \u0939\u0948\u0902 \u0914\u0930 \u091a\u093e\u0939\u0924\u0947 \u0939\u0948\u0902 \u0914\u0930 Right \u0935\u093e\u0932\u0940 table \u0915\u093e \u0938\u092d\u0940 \u0921\u093e\u091f\u093e \u0926\u0947\u0916\u0928\u093e \u091a\u093e\u0939\u0924\u0947 \u0939\u0948\u0902 Left \u0935\u093e\u0932\u0940 Table \u0915\u0947 \u091c\u094b Record Match \u0939\u094b \u0935\u0939 \u0926\u093f\u0916\u0947 \u091c\u094b Match \u0928 \u0939\u094b \u0935\u0939 \u0928\u0939\u0940\u0902 \u0926\u093f\u0916\u093e\u0908 \u0926\u0947 \u0924\u092c \u0906\u092a Right Join \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 \u0964 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">SELECT * FROM citymst a right join statemst b on a.state_id = b.state_id<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"273\" src=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-14.png?resize=640%2C273&#038;ssl=1\" alt=\"MySQL Right Join\" class=\"wp-image-9131\" srcset=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-14.png?w=761&amp;ssl=1 761w, https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-14.png?resize=300%2C128&amp;ssl=1 300w, https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-14.png?resize=150%2C64&amp;ssl=1 150w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/figure>\n<\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"cross-join\">3. CROSS JOIN<\/h2>\n\n\n\n<p>\u091c\u092c \u092d\u0940 \u0906\u092a \u0926\u094b Table \u0915\u094b \u092c\u093f\u0928\u093e \u0915\u093f\u0938\u0940 Key \u0915\u0947 Connect \u0915\u0930\u0924\u0947 \u0939\u0948 \u0924\u092c \u0909\u0938\u0947 Cross Join \u0915\u0939\u093e \u091c\u093e\u0924\u093e \u0939\u0948\u0902 \u0907\u0938 Result \u0915\u094b Cartation Product \u092d\u0940 \u0915\u0939\u0924\u0947 \u0939\u0948\u0902 \u0964 \u0906\u0907\u090f \u0906\u092a\u0915\u094b Cross Join \u0938\u0947 \u0938\u0902\u092c\u0902\u0927\u093f\u0924 \u0915\u0941\u091b \u092a\u0949\u0907\u0902\u091f\u094d\u0938 \u092c\u0924\u093e\u0924\u0947 \u0939\u0948\u0902 \u0964 <\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u092f\u0926\u093f Cross Join \u092e\u0947 on a.state_id = b.state_id \u0907\u0938 \u092a\u094d\u0930\u0915\u093e\u0930 \u0938\u0947 \u0932\u093f\u0916\u0947\u0902\u0917\u0947 \u0924\u092c \u092f\u0939 Inner Join \u091c\u0948\u0938\u093e \u0915\u093e\u0930\u094d\u092f \u0915\u0930\u0947\u0917\u093e \u0964 <\/li><li>Cross Join \u0915\u0947 output \u092e\u0947 \u091c\u094b Records \u0906\u0924\u0947 \u0939\u0948\u0902 \u0935\u0939 (No of Records of Table A * No of Records of Table B) \u0939\u094b\u0924\u0947 \u0939\u0948\u0902 \u0964 \u091c\u0948\u0938\u093e \u0906\u092a \u0928\u093f\u092e\u094d\u0928 Example \u092e\u0947 \u0926\u0947\u0916\u0947\u0902\u0917\u0947 \u0915\u0940 Table A \u092e\u0947 \u0915\u0941\u0932 Records 5 \u0939\u0948\u0902 \u0914\u0930 Table B \u092e\u0947 3 Records \u0939\u0948\u0902 \u0924\u094b 5X3 \u092f\u093e\u0928\u093f \u0915\u0940 Output \u092e\u0947 15 Records \u0906\u090f\u0902\u0917\u0947 \u0964 \u0907\u0938\u0947 \u0939\u0940 Cartation Product \u0915\u0939\u093e \u0917\u092f\u093e \u0939\u0948\u0902 \u0964 <\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">SELECT * FROM citymst a CROSS join statemst b<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"234\" src=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-15.png?resize=640%2C234&#038;ssl=1\" alt=\"MySQL Cross Join\" class=\"wp-image-9134\" srcset=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-15.png?w=887&amp;ssl=1 887w, https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-15.png?resize=300%2C110&amp;ssl=1 300w, https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-15.png?resize=768%2C281&amp;ssl=1 768w, https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-15.png?resize=150%2C55&amp;ssl=1 150w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"natural-join\">4. NATURAL JOIN<\/h2>\n\n\n\n<p>Natural Join \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0928\u0947 \u0938\u0947 \u0906\u092a \u091c\u093f\u0928 \u092d\u0940 \u0926\u094b Table \u0915\u094b \u0932\u093f\u0902\u0915 \u0915\u0930 \u0930\u0939\u0947 \u0939\u0948\u0902 \u0909\u0928\u094d\u092e\u0947 \u091c\u094b Common Columns \u0935\u0939 \u0915\u0947\u0935\u0932 \u090f\u0915 \u092c\u093e\u0930 \u0939\u0940 \u0926\u093f\u0916\u093e\u0908 \u0926\u0947\u0924\u0947 \u0939\u0948\u0902 \u0964 \u0914\u0930 \u0938\u093e\u0925 \u092e\u0947 \u0906\u092a\u0915\u094b On Clause \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930 Link \u0915\u0930\u0928\u0947 \u0915\u0940 \u091c\u0930\u0942\u0930\u0924 \u0928\u0939\u0940\u0902 \u0939\u094b\u0924\u0940 \u0939\u0948\u0902 \u0964 \u0938\u093e\u0925 \u092e\u0947 \u0906\u092a Natural \u0915\u0947 \u0938\u093e\u0925 Left \u092f\u093e Right \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 \u0964 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">SELECT * FROM citymst a natural join statemst b;\nSELECT * FROM citymst a natural left join statemst b;\nSELECT * FROM citymst a natural right join statemst b;<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"270\" src=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-17.png?resize=640%2C270&#038;ssl=1\" alt=\"MySQL Natural Join\" class=\"wp-image-9153\" srcset=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-17.png?w=986&amp;ssl=1 986w, https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-17.png?resize=300%2C127&amp;ssl=1 300w, https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-17.png?resize=768%2C324&amp;ssl=1 768w, https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-17.png?resize=150%2C63&amp;ssl=1 150w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/figure>\n\n\n\n<p>\u091c\u0948\u0938\u093e \u0915\u0940 \u0906\u092a \u0926\u0947\u0916 \u0930\u0939\u0947 \u0939\u094b\u0902\u0917\u0947 \u0915\u0940 Natural Join \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0928\u0947 \u0938\u0947 \u0915\u0941\u091b \u0907\u0938 \u092a\u094d\u0930\u0915\u093e\u0930 \u0915\u0947 Changes \u0930\u093f\u091c\u0932\u094d\u091f \u092e\u0947 \u0939\u0941\u0935\u0947 \u0939\u0948\u0902 \u0964 <\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Natural Join \u092e\u0947 \u0939\u092e\u0947 On \u0915\u0947 Sath Column link \u0915\u0940 condition \u0928\u0939\u0940\u0902 \u0926\u0947\u0928\u093e \u0939\u094b\u0924\u0940 \u0939\u0948\u0902 \u0964 <\/li><li>Natural Join \u0924\u092c \u0939\u0940 \u0932\u0917\u0924\u093e \u0939\u0948\u0902 \u091c\u092c \u0926\u094b\u0928\u094b\u0902 \u091f\u0947\u092c\u0932 \u092e\u0947 \u091c\u093f\u0928 Columns \u0938\u0947 \u0932\u093f\u0902\u0915 \u0915\u0930\u0928\u093e \u0939\u094b \u0909\u0928\u0915\u0947 \u0928\u093e\u092e \u090f\u0915 \u091c\u0948\u0938\u0947 \u0939\u094b \u0914\u0930 \u0921\u093e\u091f\u093e \u091f\u093e\u0907\u092a \u092d\u0940 \u0964 <\/li><li>Natural Join \u0938\u0947 Result \u092e\u0947 \u092d\u0940 Common Column \u090f\u0915 \u0939\u0940 \u092c\u093e\u0930 \u0926\u093f\u0916\u093e\u0908 \u0926\u0947\u0924\u0947 \u0939\u0948\u0902 \u0964 <\/li><li>Natural Join \u0915\u0947 \u0938\u093e\u0925 left Right \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0928\u0939\u0940\u0902 \u0915\u0930\u0928\u0947 \u0938\u0947 \u092f\u0939 Inner join \u0938\u0947 \u0915\u093e\u0930\u094d\u092f \u0915\u0930\u0924\u093e \u0939\u0948 \u0964 <\/li><li>Natural \u0915\u0947 \u0938\u093e\u0925 \u0906\u092a Left \/ Right Join \u0915\u093e \u092d\u0940 \u0909\u092a\u092f\u094b\u0917 \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 \u0964 <\/li><\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"self-join\">5. SELF JOIN<\/h2>\n\n\n\n<p>Self Join \u0915\u094b\u0908 Clause \u0928\u0939\u0940\u0902 \u0939\u0948, \u092f\u0939 \u090f\u0915 Concept \u0939\u0948\u0902, \u091c\u092c \u0906\u092a\u0915\u0947 \u092a\u093e\u0938 \u090f\u0915 \u0939\u0940 Table \u0939\u094b \u0914\u0930 \u0916\u0941\u0926 \u0909\u0938\u0940 \u091f\u0947\u092c\u0932 \u0938\u0947 \u090f\u0915 \u092c\u093e\u0930 \u092b\u093f\u0930 \u0916\u0941\u0926 \u0938\u0947 \u0939\u0940 \u0932\u093f\u0902\u0915 \u0915\u0930\u0928\u093e \u0939\u094b \u0924\u092c \u0939\u092e Self Join Concept \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0924\u0947 \u0939\u0948\u0902 \u0964 \u0909\u092a\u0930\u094b\u0915\u094d\u0924 Example \u092e\u0947 \u0939\u092e Table a \u092e\u0947 Citymst \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930 \u0930\u0939\u0947 \u0925\u0947 \u0914\u0930 table b \u092e\u0947 \u0939\u092e Statement \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930 \u0926\u094b\u0928\u094b\u0902 \u0915\u094b \u0932\u093f\u0902\u0915 \u0915\u0930 \u0930\u0939\u0947 \u0925\u0947 , \u0907\u0938\u092e\u0947 \u0939\u092e Table a \u0914\u0930 Table b \u092e\u0947 \u0926\u094b\u0928\u094b\u0902 \u092e\u0947 \u0939\u0940 \u090f\u0915 \u0939\u0940 Table \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0947\u0902\u0917\u0947\u0964 <\/p>\n\n\n\n<p>Example \u0938\u0947 \u0938\u092e\u091d\u0928\u0947 \u0915\u0947 \u0932\u093f\u090f \u0939\u092e\u0928\u0947 Citymst Table \u092e\u0947 ho_id \u090f\u0915 Column \u0914\u0930 Add \u0915\u093f\u092f\u093e \u0939\u0948\u0902 \u091c\u093f\u0938\u092e\u0947 \u0915\u0940 \u0939\u092e \u091c\u093f\u0938 City \u092e\u0947 Head Office \u0939\u0948\u0902 \u0909\u0938\u0947 Select \u0915\u0930\u0947\u0902\u0917\u0947 \u0964 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">ALTER TABLE `citymst` ADD `ho_id` INT(5) NOT NULL AFTER `state_id`;\nUPDATE `citymst` SET `ho_id` = '1' WHERE city_id in (1, 2,3);\nUPDATE `citymst` SET `ho_id` = '4' WHERE city_id in (4, 5);<\/code><\/pre>\n\n\n\n<p>\u0909\u092a\u0930\u094b\u0915\u094d\u0924 SQL Execution \u0915\u0947 \u092c\u093e\u0926 \u0906\u092a\u0915\u094b Data \u0915\u0941\u091b \u0907\u0938 \u0924\u0930\u0939 \u0938\u0947 \u0926\u093f\u0916\u093e\u0908 \u0926\u0947\u0917\u093e\u0964 <\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"271\" height=\"163\" src=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-18.png?resize=271%2C163&#038;ssl=1\" alt=\"\" class=\"wp-image-9166\" srcset=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-18.png?w=271&amp;ssl=1 271w, https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-18.png?resize=150%2C90&amp;ssl=1 150w\" sizes=\"auto, (max-width: 271px) 100vw, 271px\" \/><\/figure>\n<\/div>\n\n\n<p>\u0905\u092c \u0939\u092e \u091a\u093e\u0939\u0924\u0947 \u0939\u0948\u0902 \u0915\u0940 Head Office \u0915\u0947 \u0928\u093e\u092e \u092d\u0940 \u0926\u093f\u0916\u093e\u090f \u091c\u093e\u090f \u0924\u092c \u0939\u092e Citymst table \u0938\u0947 Citymst Table \u0915\u094b \u0932\u093f\u0902\u0915 \u0915\u0930\u0917\u0947\u0902 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">SELECT a.city_id, a.city_nm, a.ho_id, b.city_nm FROM citymst a inner join citymst b on a.ho_id = b.city_id<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"345\" src=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-19.png?resize=640%2C345&#038;ssl=1\" alt=\"MySQL Self Join\" class=\"wp-image-9169\" srcset=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-19.png?w=739&amp;ssl=1 739w, https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-19.png?resize=300%2C162&amp;ssl=1 300w, https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-19.png?resize=60%2C31&amp;ssl=1 60w, https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/image-19.png?resize=150%2C81&amp;ssl=1 150w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/figure>\n<\/div>\n\n\n<p>\u0906\u0936\u093e \u0939\u0948\u0902 \u092e\u0941\u091d\u0947 \u0915\u0940 \u0906\u092a MySQL Table Join \u0938\u092e\u091d\u0947 \u092e\u0947 \u0906 \u0917\u090f \u0939\u0948\u0902 \u0939\u094b\u0902\u0917\u0947\u0964 MySQL Join \u0938\u0947 \u0938\u0902\u092c\u0902\u0927\u093f\u0924 \u0915\u094b\u0908 \u092d\u0940 Query \u0939\u094b \u0924\u094b \u0906\u092a \u092e\u0941\u091d\u0947 Comment \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 \u0964 \u092f\u0939 Article \u0915\u0948\u0938\u093e \u0932\u0917\u093e \u092e\u0941\u091d\u0947 \u091c\u0930\u0942\u0930 \u092c\u0924\u093e\u090f , \u0905\u092a\u0928\u093e \u0915\u0940\u092e\u0924\u0940 \u0938\u092e\u092f \u0926\u0947\u0928\u0947 \u0915\u0947 \u0932\u093f\u090f \u0927\u0928\u094d\u092f\u0935\u093e\u0926 \u0964 <\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u0939\u092e\u093e\u0930\u0947 \u0905\u0928\u094d\u092f \u0906\u0930\u094d\u091f\u093f\u0915\u0932<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/selfimagination.in\/tips\/mysql-function\/\">MySQL Function<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/mysql-stored-procedure\/\">MySQL Stored Procedure<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/get-post-method\/\">PHP Get \/Post Method \u0915\u0947 \u092c\u093e\u0930\u0947 \u092e\u0947\u0902 \u091c\u093e\u0928\u0947<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/php-math-function\/\">PHP Math Function \u0915\u0947 \u092c\u093e\u0930\u0947 \u092e\u0947\u0902 \u091c\u093e\u0928\u0947<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/learn-cpp-from-c\/\">C \u0938\u0947 C ++ \u0938\u0940\u0916\u0947 \u0938\u0930\u0932 \u0936\u092c\u094d\u0926\u094b\u0902 \u092e\u0947\u0902<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/php-variables\/\">PHP Variable \u0915\u0947 \u092c\u093e\u0930\u0947 \u092e\u0947\u0902 \u091c\u093e\u0928\u0947<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/arduino-control-structure\/\">Arduino Control Structure<\/a>&nbsp;<\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/c-union\/\">Union in C<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/c-pointer\/\">Declaration of Pointer in C<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/search-jquery\/\">jQuery Search Filter<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/mysql-table-create-alter-drop\/\">MySQL Create Table | Alter Table | Drop Table<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/api-using-node-react-express-mysql\/\">API Using NODE REACT EXPRESS MYSQL SEQUELIZE (For Backend OR Server Side)<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/cpanel\/\">CPANEL In Hindi<\/a><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>MySQL Join, MySQL Inner Join, Outer Join, Left Join, Right Join, Cross Join, Natural Join, Self Join \u0915\u0947 \u092c\u093e\u0930\u0947 \u092e\u0947 \u0938\u092e\u091d\u0947\u0902\u0917\u0947 \u0964 \u091c\u092c \u092d\u0940 \u0939\u092e\u0947 \u0926\u094b Table \u0915\u0947 \u0921\u093e\u091f\u093e \u0915\u094b \u0932\u093f\u0902\u0915 \u0915\u0930 Data \u0932\u093e\u0928\u093e \u0939\u094b\u0924\u093e \u0939\u0948\u0902 \u0924\u092c \u0939\u092e\u0947 Join Clause \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0928\u093e \u0939\u094b\u0924\u093e \u0939\u0948\u0902 \u0964 Table \u0915\u094b Join \u0915\u0930\u0928\u0947 \u0915\u0947 \u0932\u093f\u090f \u0915\u094b\u0908 \u090f\u0915 \u092f\u093e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":9195,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[5],"tags":[],"class_list":["post-9101","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mysql"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/09\/mysql-join.jpg?fit=1200%2C628&ssl=1","_links":{"self":[{"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/posts\/9101","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/comments?post=9101"}],"version-history":[{"count":82,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/posts\/9101\/revisions"}],"predecessor-version":[{"id":9193,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/posts\/9101\/revisions\/9193"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/media\/9195"}],"wp:attachment":[{"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/media?parent=9101"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/categories?post=9101"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/tags?post=9101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}