Answer the question
In order to leave comments, you need to log in
Applying correlated nested subqueries
There was a question on sql
The essence is as follows:
there are three tables , the
first, for example, with the fields “persons-titles-cities (code)”, the second “cities (code)-cities (decryption)-country (code)”, the third - “country ( code) -country (decryption) - continent.
At the input we have a variable, the value of which determines the person. What is the query to the database to get all the information from the three tables related to the person, that is, "title-city (decoding)-country (decoding)-continent"
The variant with the use of correlated nested subqueries is of particular interest.
Answer the question
In order to leave comments, you need to log in
I also wondered why correlated nested subqueries are of interest? It seems to me in this case it is not appropriate, or?
Just in case, inner join:
select person.Description, city.cityName, state.Name from person
inner join city on city.cityId = person.cityId
inner join state on state.stateId = city.stateId
where preson.id = @personId
Some too simple question. Try to solve puzzles on sql-ex.ru/ to gain experience :)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question