0

I am trying to create a table in MySQL but I keep getting an error of incorrect syntax. Below is my create table syntax, what is incorrect?

CREATE TABLE [Test].[dbo].[Ite](
[ID] [INT] NOT NULL AUTO_INCREMENT,
[ite] [varchar](500) NULL,
[dollarvalue] DECIMAL(10,2) NULL)

Here is exact error message

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].[dbo].[Ite]( [ID] [INT] NOT NULL AUTO_INCREMENT, [i' at line 1

closed as off-topic by Paul White Apr 22 '16 at 4:22

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Too localized - this could be because your code has a typo, basic error, or is not relevant to most of our audience. Consider revising your question so that it appeals to a broader audience. As it stands, the question is unlikely to help other users (regarding typo questions, see this meta question for background)." – Paul White
If this question can be reworded to fit the rules in the help center, please edit the question.

0

You're migrating SQL code intended for SQLServer. MySQL uses backticks instead of square brackets, and does not have user. The following code would be suitable for MySQL:

CREATE TABLE `Test`.`Ite` (
`ID` int NOT NULL AUTO_INCREMENT,
ite varchar(500) NULL,
dollarvalue DECIMAL(10,2) NULL);
  • Ah thank you! Yes I am migrating SQL Server syntax to MySQL – WooBin WooYeol Apr 22 '16 at 2:32
  • And get rid of .dbo. – Rick James Apr 24 '16 at 21:54
0
CREATE TABLE 'Test'.'dbo'.'Ite'(
ID INT NOT NULL AUTO_INCREMENT,
ite varchar(500) NULL,
dollarvalue DECIMAL(10,2) NULL)

There is no need for the [] brackets, when making the datatypes for the columns and also the columns names require you to have [] wrapped around them.

-3

create table table name( column_name column_type)

this is the syntax for creating a table

Not the answer you're looking for? Browse other questions tagged or ask your own question.