Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Very simple subqueries
Subqueries with multiple results
Correlated subqueries
Other subqueries
23. Subqueries – summary

Instruction

That was the last exercise in this part of the course, and you passed it with flying colors—amazing! Now, take some time to relax, and proceed to the next part when you're ready.

  • Subqueries are queries within queries,
  • We often use them in WHERE condition. If the subquery returns only one value, you can use normal mathematical signs for comparison: >, >=, =, <=, <, !=, <>,
  • If the query returns more than one value, you have to use either ALL or ANY,
  • In order to check whether a set conatins a certain value, you can use IN operator,
  • Correlated subqueries are subqueires that use columns from the outer query. This way you can make a subquery return a certain value for a certain row,
  • Subqueries can also be used in FROM clause. It acts just like normal table. Keep in mind that you have to give an alias to a subquery in the FROM clause,
  • Subqueries can also be used in SELECT clause as a column. Just remember, that such subquery has to return only one value.

Now, take your time relaxing and proceed to the next part when you're ready.

Exercise

Click Next exercise to finish this part.