Here is the scenario: lets say I have a database named sqlprac that contains a table named dept.
There are two ways to write a query:
use sqlprac
/*1*/
SELECT dept.deptno,
dept.deptname,
dept.deptsal
FROM dept;
/*2*/
SELECT deptno,
deptname,
deptsal
FROM dept;
Both queries should return the same result set. However I have seen that this isn't always the case, especially in sub query/inner query. What's the difference then?
Why should I choose one over another?
Also, a third query might be
/*3*/
SELECT *
FROM dept
I know what * is doing, but in which case we should or not use it.
Are there any performance/optimization issues?