How to drop a table if it exists?

Is it correct to do the following? No. That will drop the table only if it contains any rows (and will raise an error if the table does not exist). Instead, for a permanent table you can use Or, for a temporary table you can use SQL Server 2016+ has a better way, using DROP TABLE IF … Read more

LEFT JOIN vs. LEFT OUTER JOIN in SQL Server

As per the documentation: FROM (Transact-SQL): The keyword OUTER is marked as optional (enclosed in square brackets). In this specific case, whether you specify OUTER or not makes no difference. Note that while the other elements of the join clause is also marked as optional, leaving them out will make a difference. For instance, the entire type-part of the JOIN clause is optional, in which case … Read more