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 - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -