I don't understand why the solution gives me a nested solution when I can get the same result with non-nested SQL stmt. Is it better to use Nested SQL ? Thanks !
Here is the code :
SQL :
select EMP_ID, F_NAME, L_NAME, DEP_ID from employees;
SQL Nested/Sub-Query solution :
select * from ( select EMP_ID, F_NAME, L_NAME, DEP_ID from employees) AS EMP4ALL;
The query optimser of whichever platform you use will almost certainly parse these to be identical and produce the same execution plan for each.
In short, they are the same; the derived table query may be a cut-down version of something more complex and the author just chose to leave it that way, unknown really without more context.