zero
zero

Reputation: 1217

what is wrong with this sql statement

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

Upvotes: 2

Views: 123

Answers (5)

Murilo Vasconcelos
Murilo Vasconcelos

Reputation: 4827

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',).

Upvotes: 2

Jacob
Jacob

Reputation: 78850

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.
)

Upvotes: 4

Michael Todd
Michael Todd

Reputation: 17041

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.

Upvotes: 2

The Scrum Meister
The Scrum Meister

Reputation: 30111

The columns are missing data types.

The last column has a extra comma at the end

Upvotes: 3

Dan J
Dan J

Reputation: 16708

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

Upvotes: 2

Related Questions