Grokking SQL for Tech Interviews
Ask Author
Back to course home

0% completed

Nested Query
Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Nested queries, also known as subqueries, are SQL queries that are embedded within another SQL query. They can be used in various parts of the main query, including the SELECT, FROM, WHERE, and HAVING clauses.

Subqueries enable complex operations and can be crucial for performing advanced data manipulations and analyses directly within the database.

Example

Consider we have students and exam_results table with the following data, and we want to fetch the names of students who scored above 92 in at least 1 subject.

Query

SELECT student_name FROM Students

.....

.....

.....

Like the course? Get enrolled and start learning!

Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible