Jump to content

MySQL Workbench CREATE Table Error


LeonLatex

Recommended Posts

I am getting an error in MySQL Workbench when I want to CREATE Table. I am getting an Error, but can't find it anywhere. Can you?

CREATE TABLE 'test'.'articletext' (
'id' INT NOT NULL AUTO_INCREMENT,
'articleheading' TEXT NULL,
'articletext' TEXT NULL,
'articleauthor' TEXT NULL,
'articledate' DATE NULL,
PRIMARY KEY ('id'));

Link to comment
Share on other sites

1 hour ago, requinix said:

As a general rule of thumb, if you have an error message that you don't understand and would like help understanding what's wrong, post the error message.

 

Of course. My fault. In the heat of....
Here it is: 

14:42:15    CREATE TABLE 'test''.'articletext' ( 'id' INT NOT NULL AUTO_INCREMENT, 'articleheading' TEXT NULL, 'articletext' TEXT NULL, 'articleauthor' TEXT NULL, 'articledate' DATE NULL, PRIMARY KEY ('id'))    Error Code: 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 ''test_db'.'articletext' ( 'id' INT NOT NULL AUTO_INCREMENT, 'articlehea' at line 1    0.000 sec

Edited by LeonLatex
Link to comment
Share on other sites

You do not use single-quotes around DB identifiers like the DB name, table name, column names, etc.  Single quotes are only for string literals.

Generally you simply do not quote the identifiers at all, there's no reason too unless you're trying to use reserved words or restricted characters (which you shouldn't do anyway).  If for some reason you want to quote the identifiers, you do so using back-ticks (`).

 

  • Great Answer 1
Link to comment
Share on other sites

11 hours ago, kicken said:

You do not use single-quotes around DB identifiers like the DB name, table name, column names, etc.  Single quotes are only for string literals.

 

 

Thanks for your answers Kicken. This problem started to get so huge for me, so everything was tried in desperation. There were quotes overall sometimes 🤪

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.