Right now, will find out about the sub inquiries and how they every now and again utilized with the SELECT articulation?
This is helpful. Think about a circumstance when we need result from a table having a field which should be coordinated to a field a record from an alternate table.
This can be exceptionally muddled as first we will the primary table and afterwards, we will require all the information from the second table at that point repeat through each record and check if the record matches and if the record matches store it in the outcome and do likewise for the second record.
This can be exceptionally simple in the event that we utilize a sub-question. We would simply to choose information from the principal information and utilize a contingent where catchphrase for the field we have to check whenever coordinated with the field in the subsequent table.
For example, consider two table classifications and subcategories and we just need records from the classification which have subcategories, this should be possible by the idea clarified previously.
SELECT * FROM category WHERE cid in (SELECT * FROM subcategories);
SELECT c, c1 FROM t1, t2 WHERE c OPERATOR (SELECT c, c1 FROM t1, t2 [WHERE]);
UPDATE t SET c = new_value [ WHERE OPERATOR [ VALUE ] (SELECT c FROM t) [ WHERE) ]
SELECT * FROM EMPLOYEE WHERE ID IN (SELECT ID FROM EMPLOYEE WHERE SALARY > 20000) ;
UPDATE EMPLOYEE SET SALARY = SALARY * 2 WHERE AGE IN (SELECT AGE FROM EMPLOYEE WHERE AGE >= 27 );