Best unofficial Apache Server developers community
Username
Forgot password?
Sign in with Twitter account
Sign in with Facebook account

What is wrong with this sql statement

2

55 views

What is wrong with this statement?

CREATE TABLE `CSV_DB`.`bavaria_test` (
`Schule`,
`Stasse`,
`Ort`,
`Tel`,
`Schulgliederung`,
`Integrationsklasse`,
`Besonderheit`,
`Homepage`,
`E-Mail`,
`Schulnummer`,)
 ENGINE = MYISAM ;

#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 ' Stasse, Ort, Tel, Schulgliederung, Integrationsklasse, Besonde at line 2

asked February 3, 2011 6:38 pm CST
posted via StackOverflow

5 Answers

3
 

You need to specify the data types for the columns. Also, you don't need those back-tick quotes:

CREATE TABLE bavaria_test (
    Schule int,
    Stasse varchar(100),
    -- etc.
)

answered February 3, 2011 7:23 pm CST
2
 

The columns are missing data types.

The last column has a extra comma at the end

answered February 3, 2011 7:23 pm CST
1
 

Remove the trailing comma after Schulnummer. That comma tells it there will be another column in the list, and there is not.

answered February 3, 2011 7:23 pm CST
1
 

You've defined your column names but not given the columns a data type.

For example, Schule could be defined like:

Schule varchar(50)

which would indicate that the column is a "string" that can hold up to 50 characters.

answered February 3, 2011 7:23 pm CST
0
Best answer
 

Assuming you are using MySQL because of ENGINE = MYISAM:

You must read this. You are forgetting to specify the types of each column and you have a extra comma here 'Schulnummer',).

answered February 3, 2011 7:23 pm CST

Your answer

Join with account you already have


Sign in with Twitter account
Sign in with Facebook account
Sign in with Google Friend Connect

Preview
Similar questions
Slowquery what's wrong?
December 23, 2010
How is this regex wrong?
December 28, 2010