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 -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -