0
  CREATE TABLE 'behandelingen' (
  'behandeling_id' int(10) NOT NULL auto_increment,
  'behandeling' varchar(35) NOT NULL default '',
  'kosten' float NOT NULL default '0',
  'bank_reknr' varchar(20) NOT NULL default '',
  PRIMARY KEY  ('behandeling_id'),
  UNIQUE KEY 'behandeling' ('behandeling')
);

Trying to import a database / tables to a my local server using phpmyadmin. I keep coming up with the following error

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 ''behandelingen' ( 'behandeling_id' int(10) NOT NULL auto_increment, 'behan' at line 1 Static analysis:

4 errors were found during analysis.

A symbol name was expected! (near "'behandeling_id'" at position 34)
At least one column definition was expected. (near "'behandeling_id'" at position 34)
Unexpected beginning of statement. (near "10" at position 55)
Unrecognized statement type. (near "NOT NULL" at position 59)

can some one shed some light on it ... I am using Server version: 5.7.14 - MySQL Community Server (GPL)

1

3 Answers 3

1

Use backticks instead of single quotes on the table name and column names. See below:

CREATE TABLE `behandelingen` (
    `behandeling_id` int(10) NOT NULL auto_increment,
    `behandeling` varchar(35) NOT NULL default '',
    `kosten` float NOT NULL default '0',
    `bank_reknr` varchar(20) NOT NULL default '',
    PRIMARY KEY  (`behandeling_id`),
    UNIQUE KEY `behandeling` (`behandeling`)
);
Sign up to request clarification or add additional context in comments.

3 Comments

so the only issue was i should remove the single quotes ???? ... it does work... but this was never an issue ...any ideas why the quotes are an issue all of a sudden ?
you should use ` , not ' :-)
I chose this ..as it was the first answer
1

CREATE TABLE behandelingen ( behandeling_id int(10) NOT NULL auto_increment, behandeling varchar(35) NOT NULL default 'default' , kosten float NOT NULL default 0, bank_reknr varchar(20) NOT NULL default 'default' , PRIMARY KEY (behandeling_id), UNIQUE KEY behandeling (behandeling) );

Comments

0

I can't test it right now, but I think that you shouldn't be using single quotes to define the name of the column: e.g.

CREATE TABLE Persons ( PersonID int, LastName varchar(255), FirstName varchar(255), Address varchar(255), City varchar(255) );

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.