MySQL Subquery

MySQL Subquery

Subquery is another query that is coded with in another query.You can code the subqueries in WHERE, HAVING, FROM or SELECT clause of a SELECT statements.



Example of Subquery

SELECT student_name from student_info where student_id = 
(SELECT id from student_marks where total_marks > 90 )

Code Explanation

  • In this example it select student_name from student_info table where the value of student_id is given by subquery
PrevNext

Join Us And Get Our Latest Tutorials Updates Via Email