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:
The AWS Marketplace is an online store where people can buy and sell applications, services,…
Tongits is not just a card game—it’s a feeling every Filipino knows. It reminds us…
Your brand more than developing an attractive and creative logo and infectious motto. It's the…
The ads shown on videos, articles, or websites are called Display ads. You can supply…
Home security is not just about stopping burglars. It is about protecting your family, your…
Customer Loyalty is one of the most important things for brands today. Everyday companies come…