Basic Relocating

We wish to change the locations of the columns of a table by spelling out their names in the desired order.

SELECT col_4,
       col_1,
       col_2,
       col_3
FROM table_1;

Here is how this works:

  • The order of the columns in the output table is determined by the order of the column names we provide to SELECT. See Basic Selecting.
  • Columns that are not mentioned in the SELECT statement will be dropped.
SQL
I/O