Friday, November 9, 2012

Select from whereGroup by order by having executing order in sql


Select from whereGroup by order by having executing  order in sql


In a interview i asked the what is first execute in a sql
many people not reply any thing and some one is wrong,
 In a sql First is Selection(conditional) is execute than Projection here


Projection means choosing which columns (or expressions) the query shall return.
Selection means which rows are to be returned.

by example
Projection: what ever typed in select clause i.e, 'column list' or '*' or 'expressions' that becomes under projection.

*selection:*what type of conditions we are applying on that columns i.e, getting the records that comes under selection.

Eg: SELECT empno,ename,dno,job from Emp WHERE job='CLERK';

in the above query the columns "empno,ename,dno,job" those comes under projection, "where job='clerk'" comes under selection


here db  executed the  line by
from
where
having
order by
Group by
Select

No comments:

Post a Comment