What is this?
SQL query:
ALTER TABLE `ads` ADD `ad_title` VARCHAR NOT NULL
MySQL said:
#1064 - 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 'NOT NULL' at line 1
Query is generated by phpmyadmin
您没有为VARCHAR
分配长度。
The syntax error in this sentence lies in the type definition of the column. It should specify the maximum length of the VARCHAR
column.
ALTER TABLE `ads` ADD `ad_title` VARCHAR(10) NOT NULL
It is working in this sqlfiddle .
See the following example, where length 50 is assigned to columns First_Name
and Surname
:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.