Where does the query table "taxonomy_term_data_node" come from? I'm troubleshooting a Views' query which uses taxonomy_term_data_node.weight, but  there is no table of this name. Actually, the table name is taxonomy_term_data as you well know. So how is this table reference made? I do not see that alias in the query.

SELECT node.title AS node_title, node.nid AS nid, 
  taxonomy_term_data_node_1.weight AS taxonomy_term_data_node_1_weight, 
  taxonomy_term_data_node.weight AS taxonomy_term_data_node_weight, 
  'node' AS field_data_field_category_child_node_entity_type, 
  'node' AS field_data_field_category_parent_node_entity_type
FROM {node} node

LEFT JOIN (
  SELECT td.*, tn.nid AS nid
    FROM {taxonomy_term_data} td                                
    LEFT JOIN {taxonomy_vocabulary} tv ON td.vid = tv.vid
    LEFT JOIN {taxonomy_index} tn ON tn.tid = td.tid                
    WHERE  (tv.machine_name IN ('category_child')
  ) 
) taxonomy_term_data_node ON node.nid = taxonomy_term_data_node.nid

INNER JOIN (
  SELECT td.*, tn.nid AS nid
  FROM {taxonomy_term_data} td
  INNER JOIN {taxonomy_vocabulary} tv ON td.vid = tv.vid
  INNER JOIN {taxonomy_index} tn ON tn.tid = td.tid
  WHERE (tv.machine_name IN  ('category_parent')) 
) taxonomy_term_data_node_1 ON node.nid = taxonomy_term_data_node_1.nid

WHERE (((node.status = '1') AND (node.type IN ('group_by_test'))))
ORDER BY taxonomy_term_data_node_1_weight ASC, taxonomy_term_data_node_weight ASC
LIMIT 1000 
OFFSET 0
taxonomy_term_data_node is the alias used for the SELECT that is part of the first LEFT JOIN.

LEFT JOIN (
  SELECT td.*, tn.nid AS nid
    FROM {taxonomy_term_data} td                                
    LEFT JOIN {taxonomy_vocabulary} tv ON td.vid = tv.vid
    LEFT JOIN {taxonomy_index} tn ON tn.tid = td.tid                
    WHERE  (tv.machine_name IN ('category_child')
  ) 
) taxonomy_term_data_node ON node.nid = taxonomy_term_data_node.nid