What are derived Tables?

 Posted by Ddd on 2/2/2011 | Category: Sql Server Interview questions | Views: 6270 | Points: 40

They are basically select statements in the from clause referred to by an
alias name.The alias name creates a table in the result set that can then be
referred to by some other Select statement

2 tables emp and emp1 have got salary column. To calculate the maximun
salary from the salary columns of 2 tables

select max(salary) from (select salary from emp union select salary from emp1) a

a: is the derived table that will provide the input to the outer query

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response