SQL Server MySQL equivalent USE

In MySQL, you can use the USING keyword in a join when you join columns from different tables with the same name. For example, these queries give the same result:

SELECT * FROM user INNER JOIN perm USING (uid) SELECT * FROM user INNER JOIN perm ON user.uid = perm.uid 

Is there an equivalent shortcut in SQL Server?

+4
source share
3 answers

no, you have to use:

 SELECT * FROM user INNER JOIN perm ON user.uid = perm.uid 
+13
source

No, SQL Server does not support this shortcut.

I would like to point out that even if this is so, labels like these are NOT A GOOD IDEA. I recently worked on a database where the developers thought it would be nice to use the *= and =* shortcuts for RIGHT JOIN and LEFT JOIN. It’s a good idea until someone raises the SQL compatibility level to 90. Then it became a very bad idea.

So study with us. Shortcuts are bad. A little extra set never killed anyone.

+5
source

In addition, I would add that in order not to use wild symbols "*" in your select statement - explicitly indicate the column name.

+1
source

All Articles