79151623

Date: 2024-11-02 21:41:06
Score: 0.5
Natty:
Report link

when the subquery is no longer self contained , you need to have a connection between inner query and outer query that is why we use correlated queries which means It calculates for each line based on the data it receives from the outer query. for example use pubs data set and try this :

select title , [type] , price ,

(select avg(price) from dbo.titles as InnerQuery where InnerQuery.[type] = OuterQuery.[type]) as AVGPrice

from dbo.titles as OuterQuery

as a result you will have the average price of each book type

Reasons:
  • Whitelisted phrase (-1): try this
  • Long answer (-0.5):
  • No code block (0.5):
  • Starts with a question (0.5): when the
  • Low reputation (1):
Posted by: Schima