SELECT table name. Field From. The name of the table in the middle. Does it matter if you don't write?

< H3 > SELECT table name. Field From. The name of the table in the middle. Does it matter if you don"t write?

related codes

/**/
SELECT TABLE.1,TABLE.2,TABLE.3 FROM `TABLE` WHERE ...;
/**/
SELECT 1,2,3 FROM `TABLE` WHERE ...;

there is no difference in the results of the two writing methods, so do they have any impact on performance?


personal opinion: it has no effect on performance

A more common way to write:

SELECT t.1,t.2,t.3 FROM `TABLE` t WHERE ...;

using table names can simplify operations, especially in multiple table operations, to avoid confusion

I hope I can help you. Thank you


when two tables (AMagi B) jointly query, if there is a field with the same name, you need to add a table name or table alias in front of the field of the same name to distinguish, for example, (SELECT
A.name, Bline name FROM.)


does not affect, the performance of the sql statement is mainly reflected in the speed of query optimization, the query tree generated by the two methods is the same, so the query optimization process is also the same.

Menu