Subquery in MySQL means Query inside another query on SELECT, INSERT, UPDATE or DELETE.
A subquery must be enclosed with parentheses and can be used anywhere in an expression.
The main advantages of subqueries is that it allow queries that are structured so that, it is possible to isolate each part of the statement and they provide an alternative ways to perform the operations that would otherwise require the complex joins and unions.
Most of the people find subqueries that are more readable than complex joins or unions.
SELECT * from users WHERE user_country IN (SELECT country_id FROM countries);
Few things you need to remember:
Read Also: MySQL Query Functions
More tips:
For any types of queries, you can contact us on info[at]namasteui.com.
We've gotten so used to seeing men streetwear joggers, ripped jeans, and sleeveless shirts. Hair…
When it comes to festivals, the options for wedding jewellery are endless. You can go…
Whether it concerns your home or an office building, the state of a property’s windows…
You know that running an environmentally sustainable business is the right thing to do. But…
If you are in a financial crisis , or need to start a new business…
To realize the strategic advantage from the fleet management system (FMS) and differentiate the business…