Implicit Column Selection

Oftentimes we wish to select columns, not by explicitly spelling out their names or positions, but by criteria satisfied by the desired columns. The three most common scenarios are:

  1. Name Pattern where we cover how to select columns whose names satisfy a given pattern e.g. select columns with a name that contains the string ‘_id’ .
  2. Data Type where we cover how to select columns of one or more data types e.g. select columns with a numeric data type.
  3. Data Criteria where we cover how to select columns whose data satisfies a certain condition e.g. the percentage of missing values is below 10%.

In Multiple Conditions, we cover how to combine multiple conditions in different ways to realize more complex column selection logic

Implicit column selection works in two steps:

  1. Identification We write logic that checks which columns of a table satisfy certain conditions returns the names of the columns to be selected.
  2. Extraction This output from step 1 is then passed to the selection operator SELECT to carry out the extraction of columns from the original table.
SQL
I/O