strongduanmu commented on issue #22355:
URL: 
https://github.com/apache/shardingsphere/issues/22355#issuecomment-1324811096

   According to MySQL document, when the user uses using , duplicate associated 
columns are also removed.
   
   ```
   Redundant columns of a NATURAL join do not appear. Consider this set of 
statements:
   
   CREATE TABLE t1 (i INT, j INT);
   CREATE TABLE t2 (k INT, j INT);
   INSERT INTO t1 VALUES(1, 1);
   INSERT INTO t2 VALUES(1, 1);
   SELECT * FROM t1 NATURAL JOIN t2;
   SELECT * FROM t1 JOIN t2 USING (j);
   In the first [SELECT](https://dev.mysql.com/doc/refman/8.0/en/select.html) 
statement, column j appears in both tables and thus becomes a join column, so, 
according to standard SQL, it should appear only once in the output, not twice. 
Similarly, in the second SELECT statement, column j is named in the USING 
clause and should appear only once in the output, not twice.
   
   Thus, the statements produce this output:
   
   +------+------+------+
   | j    | i    | k    |
   +------+------+------+
   |    1 |    1 |    1 |
   +------+------+------+
   +------+------+------+
   | j    | i    | k    |
   +------+------+------+
   |    1 |    1 |    1 |
   +------+------+------+
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to