{"id":103377,"date":"2021-07-13T11:00:00","date_gmt":"2021-07-13T08:00:00","guid":{"rendered":"https:\/\/examples.javacodegeeks.com\/?p=103377"},"modified":"2022-07-08T15:19:01","modified_gmt":"2022-07-08T12:19:01","slug":"sql-join-tutorial","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/sql-join-tutorial\/","title":{"rendered":"SQL Join Tutorial"},"content":{"rendered":"<p>In this article, we will discuss JOINs in SQL (Structured Query Language), various types of <code>JOIN<\/code>s, and their syntax. We will also run <code>SELECT<\/code> queries using different types of <code>JOIN<\/code>s on data in sample tables and view the result sets.<\/p>\n<p>You can also check this tutorial in the following video:<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/www.youtube.com\/watch?v=0Pg2fvSC05A\"><img decoding=\"async\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/07\/SQL-Join-Tutorial-1024x576.jpg\" alt=\"\" class=\"wp-image-113878\" width=\"512\" height=\"288\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/07\/SQL-Join-Tutorial-1024x576.jpg 1024w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/07\/SQL-Join-Tutorial-300x169.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/07\/SQL-Join-Tutorial-768x432.jpg 768w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/07\/SQL-Join-Tutorial.jpg 1280w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><\/a><figcaption>SQL Join Tutorial &#8211; video<\/figcaption><\/figure>\n<\/div>\n<h2 class=\"wp-block-heading\" id=\"h-1-introduction\">1. Introduction<\/h2>\n<p>In real-world applications, data are stored in <code><a href=\"https:\/\/en.wikipedia.org\/wiki\/Relational_database\">RDBMS<\/a><\/code> (Relational Database Management Systems) by removing redundancy and assigning primary or composite keys to identify them uniquely. This is part of normalization. Relationships of data stored in multiple tables are set by the primary key and foreign key mechanism. Thus, persisted data represents domain entity relationships like one-to-one and one-to-many. For example, let&#8217;s say we have an <code>orders<\/code> table. The details of each order are stored in another table, say <code>order_details<\/code>. Order details are linked to orders using the common column <code>order_id<\/code>. The orders table is called the parent table and the <code>order_details<\/code> table is called the child table.<\/p>\n<p>When we want to retrieve data from multiple tables, <code>JOIN<\/code>s are the mechanism to construct the condition to retrieve meaningful data.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-2-what-are-joins-in-sql\">2. What are Joins in SQL?<\/h2>\n<p>Joins extract information from multiple tables or views satisfying certain condition(s) and combine them into a result set. Typically primary and foreign keys are used to link tables in the join condition.<\/p>\n<p>Different types of Joins that we will demonstrate in this article are:<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/joins-w.jpg\"><img decoding=\"async\" width=\"750\" height=\"360\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/joins-w.jpg\" alt=\"sql join\" class=\"wp-image-103384\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/joins-w.jpg 750w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/joins-w-300x144.jpg 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/a><\/figure>\n<\/div>\n<h2 class=\"wp-block-heading\" id=\"h-3-tables-and-data\">3. Tables and Data<\/h2>\n<p>For running the queries of Inner and Outer joins, we will use a <code>book_store<\/code> database consisting of three tables: <code>locations<\/code>, <code>publishers<\/code> and <code>books<\/code>.<\/p>\n<p>For the remaining three joins, viz <code>Self Join<\/code>, <code>Semi Join<\/code> and <code>Anti Join<\/code>, we will use an hr database consisting of two tables: <code>departments<\/code> and <code>employees<\/code>.<\/p>\n<p>The following diagram shows the structure of these tables.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/tables-w.jpg\"><img decoding=\"async\" width=\"750\" height=\"271\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/tables-w.jpg\" alt=\"sql join\" class=\"wp-image-103398\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/tables-w.jpg 750w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/tables-w-300x108.jpg 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/a><\/figure>\n<\/div>\n<h2 class=\"wp-block-heading\" id=\"h-4-definitions-syntax-and-results\">4. Definitions, Syntax and Results<\/h2>\n<h3 class=\"wp-block-heading\" id=\"h-4-1-part-i\">4.1 PART-I<\/h3>\n<p>In this section, we will discuss <code>Inner Join<\/code> and the <code>Outer Join<\/code>s (Left, Right and Full).<\/p>\n<h4 class=\"wp-block-heading\" id=\"h-4-1-1-inner-join\">4.1.1 Inner Join<\/h4>\n<p>The Inner Join is used when you want rows that have exact matches for the join column values.<\/p>\n<p>Suppose we want to know the books in our database and their publisher names. This data is retrieved with the following query:<\/p>\n<pre class=\"wp-block-preformatted brush:sql\">SELECT *\nFROM books b\nINNER JOIN publishers p\nON (b.publisher_id = p.publisher_id);\n<\/pre>\n<p>This returns books and publishers rows where <code>publisher_id<\/code> is the same. A screenshot of the result set is given below:<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot1-w.jpg\"><img decoding=\"async\" width=\"745\" height=\"128\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot1-w.jpg\" alt=\"sql join\" class=\"wp-image-103385\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot1-w.jpg 745w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot1-w-300x52.jpg 300w\" sizes=\"(max-width: 745px) 100vw, 745px\" \/><\/a><\/figure>\n<\/div>\n<p>In the <code>SELECT<\/code> clause, instead of all columns (*), we can specify some columns only, say those with business values avoiding columns with id numbers. You can drop the keyword <code>INNER<\/code> and use just the keyword <code>JOIN<\/code>.<\/p>\n<p>The modified query and the returned rows are given below:<\/p>\n<pre class=\"wp-block-preformatted brush:sql\">SELECT b.title, b.author, p.name publisher\nFROM books b\nJOIN publishers p\nON (b.publisher_id = p.publisher_id);\n\n<\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot2-w.jpg\"><img decoding=\"async\" width=\"750\" height=\"140\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot2-w.jpg\" alt=\"sql join\" class=\"wp-image-103386\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot2-w.jpg 750w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot2-w-300x56.jpg 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/a><\/figure>\n<\/div>\n<h4 class=\"wp-block-heading\" id=\"h-4-1-2-left-outer-join\">4.1.2 Left Outer Join<\/h4>\n<p>When you use <code>LEFT OUTER JOIN<\/code>, the table &#8220;before&#8221; these keywords is the &#8220;left&#8221; table and is specified in the FROM clause. It will have <em>all<\/em> its rows in the result set.<\/p>\n<p>In rows that match the join condition, there will be values from both tables. In the unmatched rows, the &#8220;left&#8221; table columns will have values from the database (except the join column), but the &#8220;right&#8221; table columns will have <code>NULL<\/code> values.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p>Let&#8217;s say we want to retrieve all <code>locations<\/code> and <code>publishers<\/code> where ever they are present. The query for this requirement is:<\/p>\n<pre class=\"wp-block-preformatted brush:sql\">SELECT *\nFROM locations l\nLEFT OUTER JOIN publishers p\nON (l.location_id = p.location_id);\n<\/pre>\n<p>Result set for this query is as given below:<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot3-w.jpg\"><img decoding=\"async\" width=\"750\" height=\"235\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot3-w.jpg\" alt=\"sql join\" class=\"wp-image-103387\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot3-w.jpg 750w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot3-w-300x94.jpg 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/a><\/figure>\n<\/div>\n<p>The keyword <code>OUTER<\/code> is optional. <code>LEFT JOIN<\/code> means a <code>LEFT OUTER JOIN<\/code>. So, we drop the <code>OUTER<\/code> keyword from our query. Let&#8217;s also say we do not want the publisher location ids, we want to title the publisher name column as <code>publisher_name<\/code>, and want the data to be ordered by the location table&#8217;s location ids. The query then is:<\/p>\n<pre class=\"wp-block-preformatted brush:sql\">SELECT l.*, p.name publisher_name\nFROM locations l\nLEFT JOIN publishers p\nON (l.location_id = p.location_id)\nORDER BY l.location_id;\n<\/pre>\n<p>The output of this query is given below:<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot4-w.jpg\"><img decoding=\"async\" width=\"750\" height=\"377\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot4-w.jpg\" alt=\"\" class=\"wp-image-103388\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot4-w.jpg 750w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot4-w-300x151.jpg 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/a><\/figure>\n<\/div>\n<p>We can extend the <code>LEFT JOIN<\/code> to three tables too by joining the above query with the books table. The query will be:<\/p>\n<pre class=\"wp-block-preformatted brush:sql\">SELECT l.*, p.name publisher_name, b.title, b.author\nFROM locations l\nLEFT JOIN publishers p\nON (l.location_id = p.location_id)\nLEFT JOIN books b\nON (p.publisher_id = b.publisher_id)\nORDER BY l.location_id, p.publisher_id, b.book_id;\n<\/pre>\n<p>The result set returned:<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot5-w.jpg\"><img decoding=\"async\" width=\"750\" height=\"217\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot5-w.jpg\" alt=\"\" class=\"wp-image-103389\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot5-w.jpg 750w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot5-w-300x87.jpg 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/a><\/figure>\n<\/div>\n<h4 class=\"wp-block-heading\" id=\"h-4-1-3-right-outer-join\">4.1.3 Right Outer Join<\/h4>\n<p>The right outer join is the mirror image of the left outer join. The result set will have <em>all<\/em> rows from the &#8220;right&#8221; table.<br \/>In rows that match the join condition, there will be values from both tables. In the unmatched rows, the &#8220;right&#8221; table columns (except the join column) will have values from the database, but the &#8220;left&#8221; table columns will have <code>NULL<\/code> values.<\/p>\n<p>As an example, we want to show all the publishers in our database whether we have their books or not. The query is:<\/p>\n<pre class=\"wp-block-preformatted brush:sql\">SELECT *\nFROM books b\nRIGHT OUTER JOIN publishers p\nON (p.publisher_id = b.publisher_id);\n<\/pre>\n<p>The result is as follows:<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot6-w.jpg\"><img decoding=\"async\" width=\"750\" height=\"185\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot6-w.jpg\" alt=\"\" class=\"wp-image-103390\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot6-w.jpg 750w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot6-w-300x74.jpg 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/a><\/figure>\n<\/div>\n<p>The keyword <code>OUTER<\/code> is optional. <code>RIGHT JOIN<\/code> means <code>RIGHT OUTER JOIN<\/code>. So, we drop the <code>OUTER<\/code> keyword from our query. Also, we want to drop the <code>book_id<\/code> and <code>publisher_id<\/code> columns and title the publisher name column as <code>publisher_name<\/code>. Then the query is<\/p>\n<pre class=\"wp-block-preformatted brush:sql\">SELECT b.title, b.author, p.name publisher_name\nFROM books b\nRIGHT JOIN publishers p\nON (p.publisher_id = b.publisher_id);\n<\/pre>\n<p>The output is as follows:<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot7-w.jpg\"><img decoding=\"async\" width=\"750\" height=\"226\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot7-w.jpg\" alt=\"\" class=\"wp-image-103391\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot7-w.jpg 750w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot7-w-300x90.jpg 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/a><\/figure>\n<\/div>\n<p>We can extend the <code>RIGHT JOIN<\/code> to three tables too by joining the above query with the locations table. The query will be:<\/p>\n<pre class=\"wp-block-preformatted brush:sql\">SELECT b.title, b.author, p.name publisher_name, l.city\nFROM books b\nRIGHT JOIN publishers p\nON (p.publisher_id = b.publisher_id)\nRIGHT JOIN locations l\nON (l.location_id = p.location_id)\nORDER BY l.location_id, p.publisher_id, b.book_id;\n<\/pre>\n<p>The output is as given below:<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot8-w.jpg\"><img decoding=\"async\" width=\"750\" height=\"251\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot8-w.jpg\" alt=\"\" class=\"wp-image-103392\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot8-w.jpg 750w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot8-w-300x100.jpg 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/a><\/figure>\n<\/div>\n<h4 class=\"wp-block-heading\" id=\"h-4-1-4-full-outer-join\">4.1.4 Full Outer Join<\/h4>\n<p>The full outer join combines the functionality of the left outer join and the right outer join. It returns a result set that includes rows from both left and right tables.<br \/>In &#8220;left&#8221; table rows that do not have matching &#8220;right&#8221; table rows, the &#8220;left&#8221; table columns will have values from the database but the &#8220;right&#8221; table values will have NULL values.<br \/>Similarly, in &#8220;right&#8221; table rows that do not have matching &#8220;left&#8221; table rows, the &#8220;right&#8221; table columns will have values from the database but the &#8220;left&#8221; table will columns will have <code>NULL<\/code> values.<\/p>\n<pre class=\"wp-block-preformatted brush:sql\">SELECT *\nFROM locations l\nFULL OUTER JOIN publishers p\nON (l.location_id = p.location_id);\n<\/pre>\n<p>The result set is as given below:<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot9-w.jpg\"><img decoding=\"async\" width=\"750\" height=\"267\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot9-w.jpg\" alt=\"\" class=\"wp-image-103393\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot9-w.jpg 750w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot9-w-300x107.jpg 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/a><\/figure>\n<\/div>\n<p>As in left join and right join, the keyword <code>OUTER<\/code> is optional here too. Also, we can extend the outer join to three tables. The query for this requirement is:<\/p>\n<pre class=\"wp-block-preformatted brush:sql\">SELECT l.city, p.name publisher_name, b.title, b.author\nFROM locations l\nFULL JOIN publishers p\nON (l.location_id = p.location_id)\nFULL JOIN books b\nON (p.publisher_id = b.publisher_id)\nORDER BY l.city;\n<\/pre>\n<p>The output is as given below:<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot10-w.jpg\"><img decoding=\"async\" width=\"750\" height=\"267\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot10-w.jpg\" alt=\"\" class=\"wp-image-103394\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot10-w.jpg 750w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot10-w-300x107.jpg 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/a><\/figure>\n<\/div>\n<p>MySQL does not support the <code>FULL OUTER JOIN<\/code> keywords. The full outer join in MySQL is accomplished by a <code>UNION<\/code> of the left outer join and right outer join. Therefore, the full outer join queries will have the following syntax:<\/p>\n<pre class=\"wp-block-preformatted brush:sql\">SELECT *\nFROM locations l\nLEFT JOIN publishers p\nON (l.location_id = p.location_id)\nUNION\nSELECT *\nFROM locations l\nRIGHT JOIN publishers p\nON (l.location_id = p.location_id);\n<\/pre>\n<pre class=\"wp-block-preformatted brush:sql\">SELECT l.city, p.name publisher_name, b.title, b.author\nFROM locations l\nLEFT OUTER JOIN publishers p\nON (l.location_id = p.location_id)\nLEFT OUTER JOIN books b\nON (p.publisher_id = b.publisher_id)\nUNION\nSELECT l.city, p.name publisher_name, b.title, b.author\nFROM locations l\nRIGHT OUTER JOIN publishers p\nON (l.location_id = p.location_id)\nRIGHT OUTER JOIN books b\nON (p.publisher_id = b.publisher_id)\nORDER BY city;\n<\/pre>\n<p>Output in MySQL will be the same as that shown in the previous two screenshots.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-4-2-part-ii\">4.2 PART-II<\/h3>\n<p>In this section, we will cover <code>Self Join<\/code>, <code>Semi Join<\/code> and <code>Anti Join<\/code>. For these, we will use the hr database of two tables &#8212; <code>employees<\/code> and <code>departments<\/code>.<\/p>\n<h4 class=\"wp-block-heading\" id=\"h-4-2-1-self-join\">4.2.1 Self Join<\/h4>\n<p>A self-join is a unary relation in which a table is joined with itself. Each row of the table is joined with all rows including itself, depending on some condition(s).<\/p>\n<p>A real-world use case is of a table that stores events and we need to extract meaningful insights from that table itself. For example, the most delayed event in a table, where the delay is calculated by the delta of the timestamp of each event and its previous event.<\/p>\n<p>The most common example is the reporting of employees and their managers&#8217; names from the <code>employees<\/code> table. You can write the query using either the <code>WHERE<\/code> keyword or <code>JOIN<\/code> \/ <code>ON<\/code> keywords, as shown below:<\/p>\n<pre class=\"wp-block-preformatted brush:sql\">SELECT e1.first_name, e1.last_name, e2.first_name mgr_first_name, e2.last_name mgr_last_name\nFROM employees e1, employees e2\nWHERE e1.manager_id = e2.employee_id;\n<\/pre>\n<pre class=\"wp-block-preformatted brush:sql\">SELECT e1.first_name, e1.last_name, e2.first_name mgr_first_name, e2.last_name mgr_last_name\nFROM employees e1\nJOIN employees e2\nON e1.manager_id = e2.employee_id;\n<\/pre>\n<p>The output for these is given in the following screenshot:<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot11-w.jpg\"><img decoding=\"async\" width=\"750\" height=\"394\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot11-w.jpg\" alt=\"\" class=\"wp-image-103395\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot11-w.jpg 750w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot11-w-300x158.jpg 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/a><\/figure>\n<\/div>\n<h4 class=\"wp-block-heading\" id=\"h-4-2-2-semi-join\">4.2.2 Semi Join<\/h4>\n<p>You use semi-join when you want to select rows from the first table only, but use the second table to decide which rows to return.<\/p>\n<p>For example, let&#8217;s say you are asked to provide the list of all employees and their department names, but the department id should be between 2000 and 4000. As a programmer, your department (IT) id is 5000 and you feel excluded. You may be tempted to ask, why, what is so special about the other departments? You even suspect they are getting extra bonus. But then corporate career has taught that you never question your boss or senior management, so you write the query without any complaints and send them the output.<\/p>\n<p>The query can be written with either the <code>IN<\/code> keyword or the <code>EXISTS<\/code> keyword, as shown below.<\/p>\n<pre class=\"wp-block-preformatted brush:sql\">SELECT e.first_name, e.last_name, d.name department_name\nFROM employees e, departments d\nWHERE e.department_id = d.department_id\nAND d.department_id IN\n(SELECT d.department_id\nWHERE d.department_id BETWEEN 2000 AND 4000\n);\n<\/pre>\n<pre class=\"wp-block-preformatted brush:sql\">SELECT e.first_name, e.last_name, d.name department_name\nFROM employees e, departments d\nWHERE e.department_id = d.department_id\nAND EXISTS\n(SELECT d.department_id\nWHERE d.department_id BETWEEN 2000 AND 4000\n);\n<\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot12-w.jpg\"><img decoding=\"async\" width=\"750\" height=\"764\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot12-w.jpg\" alt=\"\" class=\"wp-image-103396\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot12-w.jpg 750w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot12-w-295x300.jpg 295w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot12-w-70x70.jpg 70w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/a><\/figure>\n<\/div>\n<p>For performance, <code>EXISTS<\/code> is preferred. Output of both queries is in the screenshot given below:<\/p>\n<h4 class=\"wp-block-heading\" id=\"h-4-4-3-anti-join\">4.4.3 Anti Join<\/h4>\n<p>Anti-join is like the semi-join to select rows from the first table only, but using a negative condition on the second table to decide which rows to return.<\/p>\n<p>In our example, it can be used to retrieve all employees and their department names, but the department id should not be between 2000 and 4000. If this task comes from the management, naturally you will be happy since the I.T. department of which you are a member has a department id that is not between 2000 and 4000.<\/p>\n<p>The query and the output are given below:<\/p>\n<pre class=\"wp-block-preformatted brush:sql\">SELECT e.first_name, e.last_name, d.name department_name\nFROM employees e, departments d\nWHERE e.department_id = d.department_id\nAND NOT EXISTS\n(SELECT d.department_id\nWHERE d.department_id BETWEEN 2000 AND 4000\n);\n<\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot13-w.jpg\"><img decoding=\"async\" width=\"750\" height=\"470\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot13-w.jpg\" alt=\"\" class=\"wp-image-103397\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot13-w.jpg 750w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/screenshot13-w-300x188.jpg 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/a><\/figure>\n<\/div>\n<h2 class=\"wp-block-heading\" id=\"h-5-download-the-source-code\">5. Download the Source Code<\/h2>\n<p>This article was a tutorial on various types of <code>SQL<\/code> <code>JOIN<\/code>s.The <code>SQL<\/code> source code for creating the tables, inserting the sample data, and all queries discussed in this article are available in a zip file. The zip file has separate scripts for PostgreSQL and MySQL.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>You can download the full source code of this example here: <a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/07\/SQL-joins.zip\"><strong>SQL Join Tutorial<\/strong><\/a><\/div>\n<p><strong>Last updated on Jan. 14th, 2022<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we will discuss JOINs in SQL (Structured Query Language), various types of JOINs, and their syntax. We will also run SELECT queries using different types of JOINs on data in sample tables and view the result sets. You can also check this tutorial in the following video: SQL Join Tutorial &#8211; video &hellip;<\/p>\n","protected":false},"author":141,"featured_media":1204,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[53],"tags":[1055],"class_list":["post-103377","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sql","tag-sql"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>SQL Join Tutorial - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"SQL Joins extract information from multiple tables or views satisfying certain condition(s) and combine them into a result set.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/sql-join-tutorial\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL Join Tutorial - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"SQL Joins extract information from multiple tables or views satisfying certain condition(s) and combine them into a result set.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/sql-join-tutorial\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-13T08:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-07-08T12:19:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Mahboob Hussain\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Mahboob Hussain\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"12 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-join-tutorial\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-join-tutorial\/\"},\"author\":{\"name\":\"Mahboob Hussain\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/7fcaa707830cfea8c55d4ad2b81cbf55\"},\"headline\":\"SQL Join Tutorial\",\"datePublished\":\"2021-07-13T08:00:00+00:00\",\"dateModified\":\"2022-07-08T12:19:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-join-tutorial\/\"},\"wordCount\":1390,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-join-tutorial\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"keywords\":[\"sql\"],\"articleSection\":[\"sql\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/sql-join-tutorial\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-join-tutorial\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/sql-join-tutorial\/\",\"name\":\"SQL Join Tutorial - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-join-tutorial\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-join-tutorial\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"datePublished\":\"2021-07-13T08:00:00+00:00\",\"dateModified\":\"2022-07-08T12:19:01+00:00\",\"description\":\"SQL Joins extract information from multiple tables or views satisfying certain condition(s) and combine them into a result set.\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-join-tutorial\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/sql-join-tutorial\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-join-tutorial\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"Bipartite Graph\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-join-tutorial\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java Development\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Core Java\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"sql\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/sql\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"SQL Join Tutorial\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/7fcaa707830cfea8c55d4ad2b81cbf55\",\"name\":\"Mahboob Hussain\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/11\/Mahboob-Hussain_avatar_1510827107-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/11\/Mahboob-Hussain_avatar_1510827107-96x96.jpg\",\"caption\":\"Mahboob Hussain\"},\"description\":\"Mahboob Hussain graduated in Engineering from NIT Nagpur, India and has an MBA from Webster University, USA. He has executed roles in various aspects of software development and technical governance. He started with FORTRAN and has programmed in a variety of languages in his career, the mainstay of which has been Java. He is an associate editor in our team and has his personal homepage at http:\/\/bit.ly\/mahboob\",\"sameAs\":[\"http:\/\/bit.ly\/mahboob\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/mahboob-hussain\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SQL Join Tutorial - Java Code Geeks","description":"SQL Joins extract information from multiple tables or views satisfying certain condition(s) and combine them into a result set.","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:\/\/examples.javacodegeeks.com\/sql-join-tutorial\/","og_locale":"en_US","og_type":"article","og_title":"SQL Join Tutorial - Java Code Geeks","og_description":"SQL Joins extract information from multiple tables or views satisfying certain condition(s) and combine them into a result set.","og_url":"https:\/\/examples.javacodegeeks.com\/sql-join-tutorial\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2021-07-13T08:00:00+00:00","article_modified_time":"2022-07-08T12:19:01+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","type":"image\/jpeg"}],"author":"Mahboob Hussain","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Mahboob Hussain","Est. reading time":"12 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/sql-join-tutorial\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/sql-join-tutorial\/"},"author":{"name":"Mahboob Hussain","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/7fcaa707830cfea8c55d4ad2b81cbf55"},"headline":"SQL Join Tutorial","datePublished":"2021-07-13T08:00:00+00:00","dateModified":"2022-07-08T12:19:01+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/sql-join-tutorial\/"},"wordCount":1390,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/sql-join-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","keywords":["sql"],"articleSection":["sql"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/sql-join-tutorial\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/sql-join-tutorial\/","url":"https:\/\/examples.javacodegeeks.com\/sql-join-tutorial\/","name":"SQL Join Tutorial - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/sql-join-tutorial\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/sql-join-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","datePublished":"2021-07-13T08:00:00+00:00","dateModified":"2022-07-08T12:19:01+00:00","description":"SQL Joins extract information from multiple tables or views satisfying certain condition(s) and combine them into a result set.","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/sql-join-tutorial\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/sql-join-tutorial\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/sql-join-tutorial\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","width":150,"height":150,"caption":"Bipartite Graph"},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/sql-join-tutorial\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java Development","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/"},{"@type":"ListItem","position":3,"name":"Core Java","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/"},{"@type":"ListItem","position":4,"name":"sql","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/sql\/"},{"@type":"ListItem","position":5,"name":"SQL Join Tutorial"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/7fcaa707830cfea8c55d4ad2b81cbf55","name":"Mahboob Hussain","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/11\/Mahboob-Hussain_avatar_1510827107-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/11\/Mahboob-Hussain_avatar_1510827107-96x96.jpg","caption":"Mahboob Hussain"},"description":"Mahboob Hussain graduated in Engineering from NIT Nagpur, India and has an MBA from Webster University, USA. He has executed roles in various aspects of software development and technical governance. He started with FORTRAN and has programmed in a variety of languages in his career, the mainstay of which has been Java. He is an associate editor in our team and has his personal homepage at http:\/\/bit.ly\/mahboob","sameAs":["http:\/\/bit.ly\/mahboob"],"url":"https:\/\/examples.javacodegeeks.com\/author\/mahboob-hussain\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/103377","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/141"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=103377"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/103377\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/1204"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=103377"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=103377"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=103377"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}