-2

I get this erroer on mysql "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 '"Staff_information" ("id" INTEGER PRIMARY KEY ,"first_name" VARCHAR,"surname" ' at line 5"

CREATE TABLE "Staff_information" ("id" INTEGER PRIMARY KEY ,"first_name" VARCHAR,"surname" VARCHAR, "Dob" INTEGER DEFAULT (null) , "Email" VARCHAR,"Telephone" VARCHAR,"Address" VARCHAR,"Department" VARCHAR, "Image" BLOB,"Gender" CHAR, "Salary" VARCHAR,"Address2" VARCHAR,"Apartment" VARCHAR,"Post_code" VARCHAR DEFAULT (null) , "Designation" VARCHAR,"Status" VARCHAR,"Date_hired" VARCHAR,"job_title" VARCHAR)

  • 2
    How is this `java`-, `jdbc`-, `netbeans`- and `connector`-related? Also, please see: [Why is β€œCan someone help me?” not an actual question?](http://meta.stackoverflow.com/q/284236) – Turing85 Jun 16 '18 at 19:15
  • This might help https://stackoverflow.com/questions/11321491/when-to-use-single-quotes-double-quotes-and-back-ticks-in-mysql – Slaw Jun 16 '18 at 19:34

2 Answers2

1

Your query has a couple of issues.

  • You should't use the "-Symbol in the create Table query
  • The DEFAULT(null) you can omit, because null is already the set default
  • You have to add the character amount to the VARCHAR and CHAR columns e.g. VARCHAR(255)

So your statement should be working looking like this:

CREATE TABLE Staff_information 
(id INTEGER PRIMARY KEY, first_name VARCHAR(255), surname VARCHAR(255), Dob INTEGER, 
Email VARCHAR(255), Telephone VARCHAR(255), Address VARCHAR(255), Department VARCHAR, 
Image BLOB, Gender CHAR(50), Salary VARCHAR(255), Address2 VARCHAR(255), Apartment 
VARCHAR(255), Post_code VARCHAR(255), Designation VARCHAR(255), Status VARCHAR(255), 
Date_hired VARCHAR(255), job_title VARCHAR(255));
David Studer
  • 105
  • 9
1

If this is MySQL, the datatype you are using should be INT, not integer.

Kevin Hill
  • 311
  • 1
  • 12