 
 /// A "qualified" relation, where all tables are identified with a table alias.
 ///
-///     SELECT ... FROM ... AS ... JOIN ... WHERE ... ORDER BY ...
-///            |        |      |        |         |            |
-///            |        |      |        |         |            • ordering
-///            |        |      |        |         • filterPromise
-///            |        |      |        • joins
-///            |        |      • alias
+///     SELECT ... FROM ... JOIN ... WHERE ... ORDER BY ...
+///            |        |        |         |            |
+///            |        |        |         |            • ordering
+///            |        |        |         • filterPromise
+///            |        |        • joins
 ///            |        • source
-///            • fullSelection
+///            • selection
 private struct SQLQualifiedRelation {
-    /// The alias for the relation
-    ///
-    ///     SELECT ... FROM ... AS ... JOIN ... WHERE ... ORDER BY ...
-    ///                            |
-    ///                            • alias
+    /// The source alias
     var alias: TableAlias { return source.alias }
     
     /// All aliases, including aliases of joined relations
     var allAliases: [TableAlias] {
-        var aliases = source.allAliases
-        for join in joins.values {
-            aliases.append(contentsOf: join.relation.allAliases)
-        }
-        return aliases
+        return joins.reduce(into: source.allAliases) {
+            $0.append(contentsOf: $1.value.relation.allAliases)
+        }
     }
     
     /// The source
     ///
-    ///     SELECT ... FROM ... AS ... JOIN ... WHERE ... ORDER BY ...
+    ///     SELECT ... FROM ... JOIN ... WHERE ... ORDER BY ...
     ///                     |
     ///                     • source
     let source: SQLQualifiedSource
     
-    /// The selection, not including selection of joined relations
-    private var ownSelection: [SQLSelectable]
+    /// The selection from source, not including selection of joined relations
+    private var sourceSelection: [SQLSelectable]
     
     /// The full selection, including selection of joined relations
     ///
-    ///     SELECT ... FROM ... AS ... JOIN ... WHERE ... ORDER BY ...
+    ///     SELECT ... FROM ... JOIN ... WHERE ... ORDER BY ...
     ///            |
-    ///            • fullSelection
+    ///            • selection
     var selection: [SQLSelectable] {
-        return joins.reduce(into: ownSelection) {
+        return joins.reduce(into: sourceSelection) {
             $0.append(contentsOf: $1.value.relation.selection)
         }
     }
     
     /// The filtering clause
     ///
-    ///     SELECT ... FROM ... AS ... JOIN ... WHERE ... ORDER BY ...
-    ///                                               |
-    ///                                               • filtersPromise
+    ///     SELECT ... FROM ... JOIN ... WHERE ... ORDER BY ...
+    ///                                        |
+    ///                                        • filtersPromise
     let filtersPromise: DatabasePromise<[SQLExpression]>
     
-    /// The ordering, not including ordering of joined relations
-    private let ownOrdering: SQLRelation.Ordering
+    /// The ordering of source, not including ordering of joined relations
+    private let sourceOrdering: SQLRelation.Ordering
     
     /// The full ordering, including orderings of joined relations
     ///
-    ///     SELECT ... FROM ... AS ... JOIN ... WHERE ... ORDER BY ...
-    ///                                                            |
-    ///                                                            • ordering
+    ///     SELECT ... FROM ... JOIN ... WHERE ... ORDER BY ...
+    ///                                                     |
+    ///                                                     • ordering
     var ordering: SQLRelation.Ordering {
-        return joins.reduce(ownOrdering) {
+        return joins.reduce(sourceOrdering) {
             $0.appending($1.value.relation.ordering)
         }
     }
     
     /// The joins
     ///
-    ///     SELECT ... FROM ... AS ... JOIN ... WHERE ... ORDER BY ...
-    ///                                     |
-    ///                                     • joins
+    ///     SELECT ... FROM ... JOIN ... WHERE ... ORDER BY ...
+    ///                              |
+    ///                              • joins
     private(set) var joins: OrderedDictionary<String, SQLQualifiedJoin>
     
     init(_ relation: SQLRelation) {

        }
        
        // (Root relation || empty selection) && no included relation => no need for any adapter
        if (startIndex == 0 || selectionWidth == 0) && scopes.isEmpty {
            return nil
        }
        

    /// Removes all selections from joins
    func selectOnly(_ selection: [SQLSelectable]) -> SQLQualifiedRelation {
        var relation = self
        relation.sourceSelection = selection.map { $0.qualifiedSelectable(with: alias) }
        relation.joins = relation.joins.mapValues { $0.selectOnly([]) }
        return relation
    }
