sql - Why is "AS emp" needed in this query -


select top 1 salary (        select top 3 salary         employees         order salary desc) emp   order salary asc 

why "as emp" used in query? query not work without using as.

the reason because need alias subquery. think of subquery creating table select , query trying reference it. might not going on, helps me justify why have add alias @ end.


Comments

Popular posts from this blog

php - Extract Text from HTTP referer -

Receive udp packets in android gstreamer -

authentication - Mongodb revoke acccess to connect test database -