LeonLatex Posted April 9, 2023 Share Posted April 9, 2023 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')); Quote Link to comment Share on other sites More sharing options...
requinix Posted April 9, 2023 Share Posted April 9, 2023 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. 1 Quote Link to comment Share on other sites More sharing options...
LeonLatex Posted April 9, 2023 Author Share Posted April 9, 2023 (edited) 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 April 9, 2023 by LeonLatex Quote Link to comment Share on other sites More sharing options...
kicken Posted April 10, 2023 Share Posted April 10, 2023 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 (`). 1 Quote Link to comment Share on other sites More sharing options...
LeonLatex Posted April 10, 2023 Author Share Posted April 10, 2023 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 🤪 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.