0

I'm tring to create a table in mysql from java desktop program but I obtain a MySqlSyntaxErrorException.

The query is :

CREATE TABLE FileXFascia(fila0 Integer,fila1 Integer,fila2 Integer,fila3 Integer) VALUES ('3','4','3','3') 

Anyone knows where I'm wrong?

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 'VALUES ('3','4','3','3')' at line 1

2
  • I don't really know my mysql syntax, but what are you trying to do here? Create the table and insert values? Shouldn't VALUES be used with an INSERT INTO? Commented Dec 20, 2014 at 14:49
  • Don't you mean INSERT INTO instead of CREATE TABLE? Commented Dec 20, 2014 at 14:49

2 Answers 2

2

You need to split these as follows:

CREATE TABLE FileXFascia(fila0 Integer,fila1 Integer,fila2 Integer,fila3 Integer); INSERT INTO FileXFascial (fila0, fila1, fila2, fila3) VALUES ('3','4','3','3'); 
Sign up to request clarification or add additional context in comments.

Comments

0

In your question there are two different operations on a table, You are trying to create and insert data in single query even in a wrong way. First you need to create table then insert data into created table. Like below syntax.

create table tableName(col1 dataType,col2 dataType,col3 dataType,.......coln dataType); 

After creation of table now you can insert data into table. Like below syntax.

insert into tableName(col1, col2,col3,......coln) values ('data1','data2','data3',......'datan'); 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.