-1

I am trying to create a new table using the following:

CREATE TABLE onsale (
    id INT AUTO_INCREMENT, 
    name VARCHAR(255), 
    desc TEXT, 
    image_file VARCHAR(255)
);

However, I keep getting an error:

ERROR 1064: (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB version for the right syntax to use near: 'desc TEXT, image_file VARCHAR(255))' at line 1

I don't see what is wrong with my syntax. It seems okay to me (obviously).

Can you tell me what I am doing wrong?

Thank you for your help.

Naveed Ramzan
  • 3,565
  • 3
  • 25
  • 30
scriptor6
  • 196
  • 3
  • 12

1 Answers1

2

The name you used for your column desc is a reserved word. You also need primary key (id):

CREATE TABLE onsale (
  id INT AUTO_INCREMENT,
  name VARCHAR(255),
  description TEXT,
  image_file VARCHAR(255),
  primary key (id)
);
Allan Wind
  • 23,068
  • 5
  • 28
  • 38