-2

Not sure why these two lines aren't letting me add a column.

    ALTER TABLE people
    ADD COLUMN job_desc VARCHAR(15) BEFORE salary;
Masiur1995
  • 15
  • 3
  • 2
    You should post the complete error message and the definition of people(don't expect us to search your previous questions) And do familiarise yoursefl with the manual https://dev.mysql.com/doc/refman/8.0/en/alter-table.html where it's clear before is not an option – P.Salmon May 22 '20 at 14:38

2 Answers2

1

From the documentation, the syntax is:

ADD [COLUMN] col_name column_definition [FIRST | AFTER col_name]

You can use FIRST or AFTER, but not BEFORE. If you want to put it before a particular column, find the preceding column and put it AFTER that one. If you want to put it before the first column, use FIRST.

Barmar
  • 741,623
  • 53
  • 500
  • 612
0

You need to use AFTER instead of before.

//e: Barmar was quicker :D

GreenPepper
  • 138
  • 2
  • 11