sql - Are these queries same? -


any pros , cons on following ways of fetching employees hr department? performance perspective?

--1 select * employee emp join department dep on emp.depid = dep.id , dep.name = 'hr';  --2 select * employee emp join (select * department dep dep.name='hr') d on emp.depid = d.id;  --3 select * employee emp join department dep on emp.depid = dep.id  dep.name = 'hr'; 

p.s. have same query plan , cost

--1 select * employee emp join department dep on emp.depid = dep.id , dep.name = 'hr'; 
  1. for me best query, because match data employee department data department hr named. restrict data department table in join.

    --2 select * employee emp join (select * department dep dep.name='hr') d on emp.depid = d.id;

  2. this baddest query, because sub query costly rdbms. first rdbms execute sub query, , match employee table. using 3 full reading table.

    --3 select * employee emp join department dep on emp.depid = dep.id dep.name = 'hr';

  3. this option write, , if see execution plan converts on same 1.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -