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)

Jens
  • 67,715
  • 15
  • 98
  • 113
Apurva
  • 461
  • 1
  • 5
  • 19
  • Possible duplicate of [When to use single quotes, double quotes, and backticks in MySQL](https://stackoverflow.com/questions/11321491/when-to-use-single-quotes-double-quotes-and-backticks-in-mysql) – Jens Aug 11 '17 at 06:11

3 Answers3

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`)
);
Zayn Ali
  • 4,765
  • 1
  • 30
  • 40
Avery
  • 44
  • 6
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) );

Faisal Rehman
  • 162
  • 1
  • 5
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) );

Rudy Palacios
  • 122
  • 2
  • 8