Answer the question
In order to leave comments, you need to log in
How to add a column to a table in a MySQL query with a check for the presence of this column?
Dear Gurus and experts please give advice.
There is a narrow framework for creating a package.
-All queries must be packed into files with the SQL extension -Many queries are
stored in the SQL file
-In one of the queries, you need to add a column to the table, but you need to check for the absence of this column.
ALTER TABLE jshopping_orders ADD bonus varchar(24) NOT NULL DEFAULT '';
Answer the question
In order to leave comments, you need to log in
MariaDB allows the syntax:
ALTER TABLE jshopping_orders ADD COLUMN IF NOT EXISTS bonus varchar(24) NOT NULL DEFAULT '';
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question