Can we add a column at a specific position to a table?


#1

Question

In the context of this exercise, can we add a column at a specific position to a table?

Answer

No, unfortunately, you cannot specify what position to add a column to a table.

By default, a new column will always be added at the end of the table. For most intents and purposes, this should not affect much, since you can always select the columns in any order, for instance, like

SELECT col3, col1, col2

If column order is very important, then an alternative is to create a new table and add the columns in the specific order they should appear.