{"id":99232,"date":"2021-01-25T11:00:00","date_gmt":"2021-01-25T09:00:00","guid":{"rendered":"https:\/\/examples.javacodegeeks.com\/?p=99232"},"modified":"2022-02-27T13:03:56","modified_gmt":"2022-02-27T11:03:56","slug":"sql-subquery-nested-query-in-sql","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/sql-subquery-nested-query-in-sql\/","title":{"rendered":"SQL Subquery &#8211; Nested Query in SQL"},"content":{"rendered":"<h2 class=\"wp-block-heading\" id=\"h-1-introduction\">1. Introduction <\/h2>\n<p>In this article, we will look at many examples of how to use SQL subquery using MySQL RDBMS.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-2-what-is-the-sql-subquery\">2. What is the SQL Subquery?<\/h2>\n<p>A subquery is also called a Nested Query. A Subquery is a Select Query inside another query. Subqueries can be used inside other select, insert, update and delete commands. It can also be used in the FROM clause, with operators like &lt;,&gt; =, etc., with the where and having clauses. Subqueries are used on a very large scale to nest multiple tables and conditions inside each other and to create very complex queries. &nbsp;&nbsp;&nbsp;<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-3-restrictions-on-subqueries\">3. Restrictions on Subqueries<\/h2>\n<p>There are some things Mysql does not allow in subqueries. The restrictions are as follows:<\/p>\n<ul class=\"wp-block-list\">\n<li>We cannot modify and select from the same table in a subquery. This applies to Insert, Update, and Delete.<\/li>\n<li>Only some of the Row comparison operators Like IN and Not IN can be used in a subquery.<\/li>\n<li>Subqueries used with the IN and Not IN clause cannot have the LIMIT clause in the subquery.<\/li>\n<\/ul>\n<p>These restrictions are mainly due to the way the mysql optimizes and implements them.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-4-syntax\">4. Syntax<\/h2>\n<p>The Basic syntax of a Subquery is as follows:<\/p>\n<pre class=\"brush:sql\">SELECT column_list (s) FROM  table_name  \nWHERE  column_name OPERATOR  \n   (SELECT column_list (s)  FROM table_name [WHERE conditions]) \n<\/pre>\n<h2 class=\"wp-block-heading\" id=\"h-5-setup-for-examples-of-subqueries\">5. Setup for examples of Subqueries<\/h2>\n<p>Forgoing through the examples related to the Intersect operator, we will consider the database called \u201cSakila\u201d. This is an example database given by MySQL. The schema structure is available on the documentation <a href=\"https:\/\/dev.mysql.com\/doc\/sakila\/en\/sakila-structure.html\" target=\"_blank\" rel=\"noreferrer noopener\">page<\/a>. For running the queries, we will use the MySQL Workbench. The documentation for MySQL Workbench is available <a href=\"https:\/\/dev.mysql.com\/doc\/workbench\/en\/\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-6-examples-for-subqueries\">6. Examples for Subqueries.<\/h2>\n<p>We will see many examples of subqueries in mysql.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-6-1-sub-query-as-a-scalar-operand\">6.1 Sub query as a scalar operand<\/h3>\n<p>A subquery can be used as a scalar operand to get a single value out. This is done in the select part of the Query. As an example<\/p>\n<pre class=\"brush:sql\">SELECT (SELECT CITY FROM CITY WHERE CITY_ID=2) FROM ADDRESS WHERE CITY_ID=2;<\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subquery_scalar.jpg\"><img decoding=\"async\" width=\"796\" height=\"272\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subquery_scalar.jpg\" alt=\"sql Subquery as a scalar\" class=\"wp-image-99233\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subquery_scalar.jpg 796w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subquery_scalar-300x103.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subquery_scalar-768x262.jpg 768w\" sizes=\"(max-width: 796px) 100vw, 796px\" \/><\/a><figcaption>Subquery as a scalar<\/figcaption><\/figure>\n<\/div>\n<h3 class=\"wp-block-heading\" id=\"h-6-2-subqueries-with-operands\">6.2 Subqueries with Operands<\/h3>\n<p>Subqueries can be used with operators like &lt;,&gt;,&lt;=,&gt;=,= etc. below are 2 examples of the same.<\/p>\n<pre class=\"brush:sql\">SELECT F.TITLE\n\tFROM FILM AS F\n\tWHERE F.LANGUAGE_ID = (SELECT LANGUAGE_ID FROM LANGUAGE WHERE NAME = 'ENGLISH')\n\tAND F.TITLE LIKE 'I%' OR 'L%' ;\n<\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subquery_oprators.jpg\"><img decoding=\"async\" width=\"810\" height=\"750\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subquery_oprators.jpg\" alt=\"sql Subquery using operators\" class=\"wp-image-99234\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subquery_oprators.jpg 810w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subquery_oprators-300x278.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subquery_oprators-768x711.jpg 768w\" sizes=\"(max-width: 810px) 100vw, 810px\" \/><\/a><figcaption>Subquery using operators<\/figcaption><\/figure>\n<\/div>\n<p>Second example<\/p>\n<pre class=\"brush:sql\">SELECT TITLE,RENTAL_RATE,REPLACEMENT_COST,RATING FROM FILM \nWHERE REPLACEMENT_COST &gt;= (SELECT AVG(REPLACEMENT_COST) FROM FILM); <\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subqueries_operators2.jpg\"><img decoding=\"async\" width=\"799\" height=\"723\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subqueries_operators2.jpg\" alt=\"sql Subquery using operators\" class=\"wp-image-99235\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subqueries_operators2.jpg 799w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subqueries_operators2-300x271.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subqueries_operators2-768x695.jpg 768w\" sizes=\"(max-width: 799px) 100vw, 799px\" \/><\/a><figcaption>Subquery using operators<\/figcaption><\/figure>\n<\/div>\n<h3 class=\"wp-block-heading\" id=\"h-6-3-sub-queries-with-in-and-not-in-operators\">6.3 Sub queries with In and Not In operators<\/h3>\n<p>Examples of subqueries with the In and Not In operators are as follows:<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<h4 class=\"wp-block-heading\" id=\"h-6-3-1-query-with-in\">6.3.1 Query with IN<\/h4>\n<p>The In operator can be used both inside and outside the subqueries. We cannot use the LIMIT clause inside the subquery when we are using the IN operator.<\/p>\n<pre class=\"brush:sql\">SELECT F.TITLE,F.DESCRIPTION,F.LENGTH,F.RATING,GROUP_CONCAT(CONCAT(A.FIRST_NAME,A.LAST_NAME) SEPARATOR ', ') AS `ACTORS`\nFROM FILM_ACTOR FA, FILM F ,ACTOR A\nWHERE F.FILM_ID = FA.FILM_ID \nAND A.ACTOR_ID = FA.ACTOR_ID\nAND F.FILM_ID IN (\n    SELECT FILM_ID FROM FILM_CATEGORY, CATEGORY\n    WHERE CATEGORY.CATEGORY_ID = FILM_CATEGORY.CATEGORY_ID\n    AND CATEGORY.CATEGORY_ID = 6)\nGROUP BY F.FILM_ID;\n<\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subquery_IN.jpg\"><img decoding=\"async\" width=\"810\" height=\"513\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subquery_IN.jpg\" alt=\"sql Subquery using IN operator\" class=\"wp-image-99236\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subquery_IN.jpg 810w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subquery_IN-300x190.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subquery_IN-768x486.jpg 768w\" sizes=\"(max-width: 810px) 100vw, 810px\" \/><\/a><figcaption>Subquery using IN operator<\/figcaption><\/figure>\n<\/div>\n<h4 class=\"wp-block-heading\" id=\"h-6-3-2-not-in-operator\">6.3.2 Not In operator<\/h4>\n<p>The same rules as the IN operator apply for the Not IN operator.<\/p>\n<pre class=\"brush:sql\">SELECT * FROM ACTOR\nWHERE ACTOR_ID NOT IN \n\t(SELECT ACTOR_ID FROM FILM_ACTOR\n\t WHERE FILM_ID IN (506,605,939))\nORDER BY FIRST_NAME;\n<\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subquery_NOT_IN.jpg\"><img decoding=\"async\" width=\"604\" height=\"693\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subquery_NOT_IN.jpg\" alt=\"Subquery using  NOT IN operator\" class=\"wp-image-99237\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subquery_NOT_IN.jpg 604w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subquery_NOT_IN-261x300.jpg 261w\" sizes=\"(max-width: 604px) 100vw, 604px\" \/><\/a><figcaption>Subquery using  NOT IN operator<\/figcaption><\/figure>\n<\/div>\n<h3 class=\"wp-block-heading\" id=\"h-6-4-nested-subqueries\">6.4 Nested Subqueries<\/h3>\n<p>Subqueries can be nested one or more times. However, too much nesting is not recommended as it may lead to performance issues especially with huge datasets. In the case of multiple nested subqueries, MySQL prefers joins instead since they are better optimized.<\/p>\n<pre class=\"brush:sql\">SELECT CONCAT(FIRST_NAME,' ',LAST_NAME) AS 'ACTORS'\nFROM ACTOR\nWHERE ACTOR_ID IN \n\t(SELECT ACTOR_ID FROM FILM_ACTOR WHERE FILM_ID = \n            (SELECT FILM_ID FROM FILM WHERE TITLE = 'BREAKFAST GOLDFINGER'));\n<\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/double_nested_subqueries.jpg\"><img decoding=\"async\" width=\"788\" height=\"380\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/double_nested_subqueries.jpg\" alt=\"SQL Subquery - Single level nesting\" class=\"wp-image-99238\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/double_nested_subqueries.jpg 788w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/double_nested_subqueries-300x145.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/double_nested_subqueries-768x370.jpg 768w\" sizes=\"(max-width: 788px) 100vw, 788px\" \/><\/a><figcaption>Single level nesting<\/figcaption><\/figure>\n<\/div>\n<p>Multiple nesting<\/p>\n<pre class=\"brush:sql\">SELECT SUM(AMOUNT) AS \"TOTAL SALES\"\nFROM PAYMENT\nWHERE RENTAL_ID IN (SELECT RENTAL_ID FROM RENTAL\n       WHERE INVENTORY_ID IN \n            (SELECT INVENTORY_ID FROM INVENTORY\n             WHERE FILM_ID IN \n                   (SELECT FILM_ID FROM FILM\n                    WHERE FILM_ID IN \n                          (SELECT FILM_ID FROM FILM_CATEGORY\n                            WHERE CATEGORY_ID IN \n                                  (SELECT CATEGORY_ID FROM CATEGORY)))));\n<\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/multi_nested_subqueries.jpg\"><img decoding=\"async\" width=\"754\" height=\"465\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/multi_nested_subqueries.jpg\" alt=\"SQL Subquery - Nesting subqueries multiple times\" class=\"wp-image-99239\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/multi_nested_subqueries.jpg 754w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/multi_nested_subqueries-300x185.jpg 300w\" sizes=\"(max-width: 754px) 100vw, 754px\" \/><\/a><figcaption>Nesting subqueries multiple times<\/figcaption><\/figure>\n<\/div>\n<h3 class=\"wp-block-heading\" id=\"h-6-5-subqueries-exists-or-not-exists\">6.5 Subqueries exists or not exists<\/h3>\n<p>The Exists and not Exists operators also use subqueries.<\/p>\n<p>Exists example<\/p>\n<pre class=\"brush:sql\">SELECT C.FIRST_NAME,C.LAST_NAME,A.ADDRESS,A.POSTAL_CODE\nFROM CUSTOMER C,ADDRESS A\nWHERE C.ACTIVE =1 \nAND C.ADDRESS_ID = A.ADDRESS_ID\nAND EXISTS (SELECT * \n            FROM CITY CT\n            WHERE  CT.COUNTRY_ID IN (8,19,24,169) \n            AND CT.CITY_ID = A.CITY_ID);\n<\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/exists_subquery.jpg\"><img decoding=\"async\" width=\"711\" height=\"492\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/exists_subquery.jpg\" alt=\"sql Subquery with Exists\" class=\"wp-image-99240\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/exists_subquery.jpg 711w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/exists_subquery-300x208.jpg 300w\" sizes=\"(max-width: 711px) 100vw, 711px\" \/><\/a><figcaption>Subquery with Exists<\/figcaption><\/figure>\n<\/div>\n<p>Not Exists example<\/p>\n<pre class=\"brush:sql\">SELECT * FROM INVENTORY WHERE\nNOT EXISTS (\n SELECT 1 FROM RENTAL where RENTAL.INVENTORY_ID =10\n AND RETURN_DATE IS NULL\n)\nLIMIT 20;\n<\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/not_exists_subquery.jpg\"><img decoding=\"async\" width=\"565\" height=\"489\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/not_exists_subquery.jpg\" alt=\"Subquery with Not Exists\" class=\"wp-image-99241\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/not_exists_subquery.jpg 565w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/not_exists_subquery-300x260.jpg 300w\" sizes=\"(max-width: 565px) 100vw, 565px\" \/><\/a><figcaption>Subquery with Not exists<\/figcaption><\/figure>\n<\/div>\n<h3 class=\"wp-block-heading\" id=\"h-6-6-subqueries-with-having\">6.6 Subqueries with Having<\/h3>\n<p>Just as we can use subqueries in the Where clause, we can also use subqueries with the Having clause as well.<\/p>\n<pre class=\"brush:sql\">SELECT * FROM FILM\nWHERE FILM_ID NOT IN(\nSELECT FILM_ID\nFROM FILM JOIN FILM_CATEGORY USING (FILM_ID) JOIN CATEGORY USING (CATEGORY_ID)\nGROUP BY CATEGORY.NAME\nHAVING AVG(LENGTH) &gt;= (SELECT AVG(LENGTH) FROM FILM))\nAND FILM_ID NOT IN(\nSELECT FILM_ID FROM INVENTORY\nWHERE INVENTORY_ID IN (SELECT INVENTORY_ID FROM RENTAL WHERE INVENTORY_ID IS NULL));\n<\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/having_subquery.jpg\"><img decoding=\"async\" width=\"810\" height=\"345\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/having_subquery.jpg\" alt=\"Subquery in the Having clause\" class=\"wp-image-99242\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/having_subquery.jpg 810w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/having_subquery-300x128.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/having_subquery-768x327.jpg 768w\" sizes=\"(max-width: 810px) 100vw, 810px\" \/><\/a><figcaption>Subquery in the Having clause<\/figcaption><\/figure>\n<\/div>\n<h3 class=\"wp-block-heading\" id=\"h-6-7-derived-tables-using-subqueries\">6.7 Derived tables using subqueries<\/h3>\n<p>WE can use a subqueries to create a temporary table. This table is used in the From clause.<\/p>\n<pre class=\"brush:sql\">SELECT AVG(AVERAGES) FROM \n\t(SELECT \n\t\tCUSTOMER_ID,\n\t\tSUM(AMOUNT) AVERAGES\n\tFROM PAYMENT\n\tGROUP BY CUSTOMER_ID) AS TOTALS;\n<\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/derived_table_subquery.jpg\"><img decoding=\"async\" width=\"668\" height=\"307\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/derived_table_subquery.jpg\" alt=\"subquery as a derived table\" class=\"wp-image-99243\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/derived_table_subquery.jpg 668w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/derived_table_subquery-300x138.jpg 300w\" sizes=\"(max-width: 668px) 100vw, 668px\" \/><\/a><figcaption>subquery as a derived table<\/figcaption><\/figure>\n<\/div>\n<h3 class=\"wp-block-heading\" id=\"h-6-8-subqueries-in-update-delete-and-insert\">6.8 Subqueries in Update, delete and insert<\/h3>\n<p>We can use subqueries to Update , insert and delete records from the schema. For these examples, we have created a new table called Cust_payments<\/p>\n<pre class=\"brush:sql\">CREATE TABLE CUST_PAYMENTS(\n    CUSTOMER_ID SMALLINT UNSIGNED,\n    FULLNAME VARCHAR(50),\n    AMOUNT INT,\n    NUMBER_OF_PAYMENTS INT\n);\n<\/pre>\n<p>Insertion Query<\/p>\n<pre class=\"brush:sql\">INSERT INTO CUST_PAYMENTS \nSELECT CUSTOMER_ID, CONCAT(FIRST_NAME, \" \", LAST_NAME) AS NAME, AMOUNT, COUNT(AMOUNT) \nFROM CUSTOMER \nJOIN PAYMENT P1 USING(CUSTOMER_ID) \nWHERE AMOUNT &gt; \n      (SELECT AVG(AMOUNT) FROM PAYMENT P2 WHERE P2.CUSTOMER_ID=P1.CUSTOMER_ID) \nGROUP BY CUSTOMER_ID;\n<\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/insert_subquery.jpg\"><img decoding=\"async\" width=\"810\" height=\"750\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/insert_subquery.jpg\" alt=\"Insert using subqueries\" class=\"wp-image-99244\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/insert_subquery.jpg 810w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/insert_subquery-300x278.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/insert_subquery-768x711.jpg 768w\" sizes=\"(max-width: 810px) 100vw, 810px\" \/><\/a><figcaption>Insert using subqueries<\/figcaption><\/figure>\n<\/div>\n<p>Update Query<\/p>\n<pre class=\"brush:sql\">UPDATE ADDRESS\n       SET DISTRICT = 'BATCAVE'\n       WHERE CITY_ID IN (SELECT CITY_ID FROM CITY WHERE CITY = 'BATMAN' );\n<\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subquery_update.jpg\"><img decoding=\"async\" width=\"810\" height=\"427\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subquery_update.jpg\" alt=\"Update with subquery\" class=\"wp-image-99245\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subquery_update.jpg 810w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subquery_update-300x158.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subquery_update-768x405.jpg 768w\" sizes=\"(max-width: 810px) 100vw, 810px\" \/><\/a><figcaption>Update with subquery<\/figcaption><\/figure>\n<\/div>\n<h3 class=\"wp-block-heading\" id=\"h-6-9-sub-queries-with-errors\">6.9 Sub queries with errors<\/h3>\n<p>We cannot use the same table in the subquery if we are trying to insert\/update\/delete from it. The below 2 examples show the error Mysql throws when this occurs<\/p>\n<pre class=\"brush:sql\">DELETE FROM CUST_PAYMENTS WHERE CUSTOMER_ID IN (\nSELECT CUSTOMER_ID FROM CUST_PAYMENTS WHERE NUMBER_OF_PAYMENTS &lt;=5);\n\nUPDATE  CUST_PAYMENTS \nSET AMOUNT = 13 \nWHERE CUSTOMER_ID IN \n       (SELECT CUSTOMER_ID FROM CUST_PAYMENTS WHERE AMOUNT =11);\n<\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subquery_ERROR.jpg\"><img decoding=\"async\" width=\"810\" height=\"314\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subquery_ERROR.jpg\" alt=\"errors\" class=\"wp-image-99246\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subquery_ERROR.jpg 810w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subquery_ERROR-300x116.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/subquery_ERROR-768x298.jpg 768w\" sizes=\"(max-width: 810px) 100vw, 810px\" \/><\/a><figcaption>errors<\/figcaption><\/figure>\n<\/div>\n<h2 class=\"wp-block-heading\" id=\"h-7-summary\">7. Summary<\/h2>\n<p>In the article, we saw examples related to the Subqueries in MySQL. We also saw the restrictions that Mysql places on users and the errors that result. More details about subqueries and how MySQL optimizes them is available <a href=\"https:\/\/dev.mysql.com\/doc\/refman\/5.7\/en\/subqueries.html\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-8-download-the-source-code\">8. Download the Source Code<\/h2>\n<p>This was an example of the SQL Subquery &#8211; Nested Query in SQL using MySQL RDBMS.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here: <a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/01\/Subqueries_examples.zip\"><strong> SQL Subquery &#8211; Nested Query in SQL <\/strong><\/a><\/div>\n<p><strong>Last updated on Feb. 27th, 2022<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. Introduction In this article, we will look at many examples of how to use SQL subquery using MySQL RDBMS. 2. What is the SQL Subquery? A subquery is also called a Nested Query. A Subquery is a Select Query inside another query. Subqueries can be used inside other select, insert, update and delete commands. &hellip;<\/p>\n","protected":false},"author":232,"featured_media":1204,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[53],"tags":[1055],"class_list":["post-99232","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 Subquery - Nested Query in SQL - Examples Java Code Geeks<\/title>\n<meta name=\"description\" content=\"1. Introduction In this article, we will look at many examples of how to use SQL subquery using MySQL RDBMS. 2. What is the SQL Subquery? A subquery is\" \/>\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-subquery-nested-query-in-sql\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL Subquery - Nested Query in SQL - Examples Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"1. Introduction In this article, we will look at many examples of how to use SQL subquery using MySQL RDBMS. 2. What is the SQL Subquery? A subquery is\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/sql-subquery-nested-query-in-sql\/\" \/>\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-01-25T09:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-02-27T11:03:56+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=\"Reshma Sathe\" \/>\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=\"Reshma Sathe\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-subquery-nested-query-in-sql\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-subquery-nested-query-in-sql\/\"},\"author\":{\"name\":\"Reshma Sathe\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/079aa9a12c7b8ebea3391ebeb6036a74\"},\"headline\":\"SQL Subquery &#8211; Nested Query in SQL\",\"datePublished\":\"2021-01-25T09:00:00+00:00\",\"dateModified\":\"2022-02-27T11:03:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-subquery-nested-query-in-sql\/\"},\"wordCount\":710,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-subquery-nested-query-in-sql\/#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-subquery-nested-query-in-sql\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-subquery-nested-query-in-sql\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/sql-subquery-nested-query-in-sql\/\",\"name\":\"SQL Subquery - Nested Query in SQL - Examples Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-subquery-nested-query-in-sql\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-subquery-nested-query-in-sql\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"datePublished\":\"2021-01-25T09:00:00+00:00\",\"dateModified\":\"2022-02-27T11:03:56+00:00\",\"description\":\"1. Introduction In this article, we will look at many examples of how to use SQL subquery using MySQL RDBMS. 2. What is the SQL Subquery? A subquery is\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-subquery-nested-query-in-sql\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/sql-subquery-nested-query-in-sql\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-subquery-nested-query-in-sql\/#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-subquery-nested-query-in-sql\/#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 Subquery &#8211; Nested Query in SQL\"}]},{\"@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\/079aa9a12c7b8ebea3391ebeb6036a74\",\"name\":\"Reshma Sathe\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/08\/reshma_sathe-96x96.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/08\/reshma_sathe-96x96.png\",\"caption\":\"Reshma Sathe\"},\"description\":\"I am a recent Master of Computer Science degree graduate from the University Of Illinois at Urbana-Champaign.I have previously worked as a Software Engineer with projects ranging from production support to programming and software engineering.I am currently working on self-driven projects in Java, Python and Angular and also exploring other frontend and backend technologies.\",\"sameAs\":[\"www.linkedin.com\/in\/reshma-sathe\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/reshma-sathe\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SQL Subquery - Nested Query in SQL - Examples Java Code Geeks","description":"1. Introduction In this article, we will look at many examples of how to use SQL subquery using MySQL RDBMS. 2. What is the SQL Subquery? A subquery is","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-subquery-nested-query-in-sql\/","og_locale":"en_US","og_type":"article","og_title":"SQL Subquery - Nested Query in SQL - Examples Java Code Geeks","og_description":"1. Introduction In this article, we will look at many examples of how to use SQL subquery using MySQL RDBMS. 2. What is the SQL Subquery? A subquery is","og_url":"https:\/\/examples.javacodegeeks.com\/sql-subquery-nested-query-in-sql\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2021-01-25T09:00:00+00:00","article_modified_time":"2022-02-27T11:03:56+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":"Reshma Sathe","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Reshma Sathe","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/sql-subquery-nested-query-in-sql\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/sql-subquery-nested-query-in-sql\/"},"author":{"name":"Reshma Sathe","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/079aa9a12c7b8ebea3391ebeb6036a74"},"headline":"SQL Subquery &#8211; Nested Query in SQL","datePublished":"2021-01-25T09:00:00+00:00","dateModified":"2022-02-27T11:03:56+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/sql-subquery-nested-query-in-sql\/"},"wordCount":710,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/sql-subquery-nested-query-in-sql\/#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-subquery-nested-query-in-sql\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/sql-subquery-nested-query-in-sql\/","url":"https:\/\/examples.javacodegeeks.com\/sql-subquery-nested-query-in-sql\/","name":"SQL Subquery - Nested Query in SQL - Examples Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/sql-subquery-nested-query-in-sql\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/sql-subquery-nested-query-in-sql\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","datePublished":"2021-01-25T09:00:00+00:00","dateModified":"2022-02-27T11:03:56+00:00","description":"1. Introduction In this article, we will look at many examples of how to use SQL subquery using MySQL RDBMS. 2. What is the SQL Subquery? A subquery is","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/sql-subquery-nested-query-in-sql\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/sql-subquery-nested-query-in-sql\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/sql-subquery-nested-query-in-sql\/#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-subquery-nested-query-in-sql\/#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 Subquery &#8211; Nested Query in SQL"}]},{"@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\/079aa9a12c7b8ebea3391ebeb6036a74","name":"Reshma Sathe","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/08\/reshma_sathe-96x96.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/08\/reshma_sathe-96x96.png","caption":"Reshma Sathe"},"description":"I am a recent Master of Computer Science degree graduate from the University Of Illinois at Urbana-Champaign.I have previously worked as a Software Engineer with projects ranging from production support to programming and software engineering.I am currently working on self-driven projects in Java, Python and Angular and also exploring other frontend and backend technologies.","sameAs":["www.linkedin.com\/in\/reshma-sathe"],"url":"https:\/\/examples.javacodegeeks.com\/author\/reshma-sathe\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/99232","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\/232"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=99232"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/99232\/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=99232"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=99232"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=99232"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}