On mysql site I need to add column not alowing null and on lines :
ALTER TABLE quizzes.docs ADD doc_code varchar(10) DEFAULT ‘-’ NOT NULL;
ALTER TABLE quizzes.docs CHANGE doc_code doc_code varchar(10) DEFAULT ‘-’ NULL AFTER employee_id;
with error :
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line
how to fix this ?
8.0.36-0ubuntu0.22.04.1
Thanks in advance!
2
Answers
Try using
'
character instead of‘
character onDEFAULT ‘-’
expression.This
Change into
But if column is not exist you should add column and change ‘ into ‘