I know it is good practice, and a performance boost, in SQL Server to prefix the table name with the schema (
dbo.TableName) in the
FROM clause of a
SELECT statement but should you also use it on other clauses like the
ON? Should you also specify the
TABLE name for
columns in the where clause if the column name is unique?
Take two scenarios:
SELECT Col1, Col2, Col3 FROM dbo.Table WHERE Col1 = Value;
SELECT Col1, Col2, Col3, FROM dbo.Table INNER JOIN dbo.Table2 ON Col1 = Col5 WHERE Col6 = Value;
In the first scenario should I add
dbo.Table to each column name?
IN the second scenario if I added an alias to each table would that automatically include the schema data too or would I still need to pre-fix the column names with the schema.
And in both scenarios do I even NEED to prefix the columns with schema data or is that pointless and gives no performance boost at all?