Link to home
Start Free TrialLog in
Avatar of ict-torquilclark
ict-torquilclark

asked on

Error Code 1064, SQL State 42000. I have an error in my SQL syntax

I am new to this SQL stuff. can any one spot why I am getting the following error?



Error code 1064, SQL state 42000: 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 'MIDDLE_NAMES VARCHAR(20),
        LAST_NAME VARCHAR(30),
    ADDRESS_LN1 VARCHAR(30),
        ' at line 5
Line 1, column 1

Executed successfully in 0.032 s, 3 rows affected.
Line 17, column 1

Executed successfully in 0.031 s, 3 rows affected.
Line 18, column 1

Error code 1064, SQL state 42000: 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 'INSERT INTO CLIENTS (FIRST_NAME) VALUES ('Andrew')
INSERT INTO CLIENTS (MIDDLE_N' at line 2
Line 19, column 1

Execution finished after 0.063 s, 2 error(s) occurred.


CREATE TABLE CLIENTS (
	CLIENT_ID INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
	TITLE VARCHAR(5),
    FIRST_NAME VARCHAR(20),
    MIDDLE_NAMES VARCHAR(20),
	LAST_NAME VARCHAR(30),
    ADDRESS_LN1 VARCHAR(30),
	ADDRESS_LN2 VARCHAR(30),
    TOWN VARCHAR(20),
    CITY VARCHAR(20),
    POST_CODE VARCHAR(8),
    DOB DATE,
    PARTNER BOOLEAN,
    PARTNER_ID INTEGER NOT NULL
)ENGINE=INNODB;
 
INSERT INTO USERS (FIRST_NAME) VALUES ('Graham'), ('Paul'), ('Mark');
INSERT INTO USERS (LAST_NAME) VALUES ('Test'), ('Trial'), ('Test');
INSERT INTO USERS (TITLE) VALUES ('Mr')
INSERT INTO CLIENTS (FIRST_NAME) VALUES ('Andrew')
INSERT INTO CLIENTS (MIDDLE_NAMES) VALUES ('Test')
INSERT INTO CLIENTS (LAST_NAME) VALUES ('Client')

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial