IntroductionIntroducing Complex QueriesJoinsWhy Joins Are ImportantInformation Retrieval Based on RelationshipsDATA Step Merges versus PROC SQL JoinsTypes of Complex QueriesDemystifying Join AlgorithmsInfluencing Joins with a Little MagicCartesian Product JoinsInner JoinsEquijoinsNon-EquijoinsReflexive or Self JoinsUsing Table Aliases in JoinsPerforming Computations in JoinsJoins with Three TablesJoins with More Than Three TablesOuter JoinsLeft Outer JoinsRight Outer JoinsFull Outer JoinsSubqueriesAlternate Approaches to SubqueriesPassing a Single Value with a SubqueryPassing More Than One Row with a SubqueryComparing a Set of ValuesCorrelated SubqueriesSet OperationsRules for Set OperatorsSet Operators and PrecedenceAccessing Rows from the Intersection of Two QueriesAccessing Rows from the Combination of Two QueriesConcatenating Rows from Two QueriesComparing Rows from Two QueriesComplex Query ApplicationsOne-to-One, One-to-Many, Many-to-One, and Many-to-Many RelationshipsProcessing First, Last, and Between Rows for BY-and GroupsDetermining the Number of Rows in an Input TableIdentifying Tables with the Most IndexesSummary