Search code examples
mysqlwampserver

Error in SQL syntax, even tho. everything seems to be normal


I have been trying to figure out whats wrong for quite long time yet I fail.

The error I get is

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 'UNSIGNED CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT NULL, `Date' at line 1

I cant seem to figure out whats wrong and this error seems to be quite common. Im not experienced with mysql, nor php for that matter.

Here is a screenshot, this is everything I enter:

enter image description here

Im unable to post pictures as my reputation is below 10, so please just check the link.

Update #1:

enter image description here

(I have also tried picking nothing typing null, picking null typing nothing and these with that tickbox on and off)


Solution

  • That UI is nuts... Remove the 'unsigned' option for the 'text' column.

    -- Update --

    If you were to create the same table manually:

    create table `Win` (
        `No` int(4) unsigned auto_increment collate utf8_unicode_ci,
        `Text` text(1000) null default null collate utf8_unicode_ci,
        `Date` timestamp default on update current_timestamp collate utf8_unicode_ci,
        index(`No`),
        index(`Text`),
        index(`Date`),
        primary key(`No`)
    ) engine=InnoDB default charset=utf8 collate utf8_unicode_ci;
    

    Take a look at phpMyAdmin, I haven't used it in years, but when I did it was a great GUI tool for administering MySQL schemas. You may also want to look at MySQL Workbench.