Register for our webinar

How to Nail your next Technical Interview

1 hour
Loading...
1
Enter details
2
Select webinar slot
*Invalid First Name
*Invalid Last Name
*Invalid Phone Number
By sharing your contact details, you agree to our privacy policy.
Select your webinar time
Step 1
Step 2
Congratulations!
You have registered for our webinar
Oops! Something went wrong while submitting the form.
1
Enter details
2
Select webinar slot
Step 1
Step 2
Confirmed
You are scheduled with Interview Kickstart.
Redirecting...
Oops! Something went wrong while submitting the form.
Iks white logo

You may be missing out on a 66.5% salary hike*

Nick Camilleri

Head of Career Skills Development & Coaching
*Based on past data of successful IK students
Iks white logo
Help us know you better!

How many years of coding experience do you have?

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Our June 2021 cohorts are filling up quickly. Join our free webinar to Uplevel your career
close
closeAbout usWhy usInstructorsReviewsCostFAQContactBlogRegister for Webinar

Attend our Free Webinar on How to Nail Your Next Technical Interview

WEBINAR +LIVE Q&A

How To Nail Your Next Tech Interview

Hosted By
Ryan Valles
Founder, Interview Kickstart
Our tried & tested strategy for cracking interviews
How FAANG hiring process works
The 4 areas you must prepare for
How you can accelerate your learnings

SQL Correlated Subqueries

Attend our Free Webinar on How to Nail Your Next Technical Interview

WEBINAR +LIVE Q&A

How To Nail Your Next Tech Interview

Hosted By
Ryan Valles
Founder, Interview Kickstart
Our tried & tested strategy for cracking interviews
How FAANG hiring process works
The 4 areas you must prepare for
How you can accelerate your learnings

SQL Correlated Subqueries

# What are Correlated Subqueries? Correlated subqueries are a type of subquery that are used when data from the outer query is needed to execute the inner query. The inner query is correlated with the outer query because it is dependent on the outer query for its execution. The inner query runs for every row of the outer query and the result of the inner query is used by the outer query. Correlated subqueries are often used when the inner query needs to find a value from the outer query and then use that value in its own where clause. This is necessary because the inner query needs to access columns from the outer query, and this is not possible with a regular subquery. Using correlated subqueries can often result in a more efficient query than using multiple joins. This is because the correlated subquery will only run once for each row of the outer query, while a join would need to run multiple times. Correlated subqueries can be used in many different types of queries, such as SELECT, UPDATE, and DELETE. They can also be used with aggregate functions, such as SUM and AVG.

Worried About Failing Tech Interviews?

Attend our webinar on
"How to nail your next tech interview" and learn

Hosted By
Ryan Valles
Founder, Interview Kickstart
Our tried & tested strategy for cracking interviews
How FAANG hiring process works
The 4 areas you must prepare for
How you can accelerate your learnings
Register for Webinar
### What is a Correlated Subquery? A correlated subquery is a subquery (a query nested inside another query) that uses values from the outer query. It is used when the inner query depends on the outer query for it to execute. ### Syntax The syntax for a correlated subquery is as follows: ``` SELECT outer_table.column_name FROM outer_table WHERE outer_table.column_name = (SELECT inner_table.column_name FROM inner_table WHERE condition); ``` ### Example For example, if we have a table called `Users` that contains a list of users and a table called `Transactions` that contains a list of transactions for each user, we can use a correlated subquery to find all users who have made at least one transaction: ``` SELECT Users.user_name FROM Users WHERE EXISTS (SELECT * FROM Transactions WHERE Transactions.user_id = Users.user_id); ```