1

I need some help in this SQL Code. I am new to SQL and using the Sams Teach Yourself SQL.

   INSERT INTO `eli`.`checks`
(`check`,
`payee`,
`amount`,
`remarks`)
VALUES
(500,'John Dree',450.00,'Bills');
INSERT INTO `eli`.`checks`
(`check`,
`payee`,
`amount`,
`remarks`)
VALUES
(575,'Ma Belle',150.00,'Gas Bills');
INSERT INTO `eli`.`checks`
(`check`,
`payee`,
`amount`,
`remarks`)
VALUES
(600,'Jon Cash',350.00,'Shopping');

I am getting 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 'payee, amount, reINSERT INTO eli`.checks' at line 1

enter image description here Thank you :)

16
  • 1
    This means that there is already a record in your checks table with the value of 19200 for your check field and you can't insert duplicates. Commented Sep 17, 2014 at 19:11
  • I change the value to 4, still getting error for Duplicate Commented Sep 17, 2014 at 19:13
  • Good news it passed when I did it to 100 Commented Sep 17, 2014 at 19:14
  • Your check field is your primary key. It cannot already exist. So if 4 exists in that table, you'll get the same error. Commented Sep 17, 2014 at 19:14
  • Now -_- I am getting 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 'payee, amount, reINSERT INTO eli.checks`' at line 1 Commented Sep 17, 2014 at 19:16

1 Answer 1

2

Try this?

INSERT INTO `eli`.`checks` (`check`, `payee`, `amount`, `remarks`) VALUES
(500, 'John Dree', 450.00, 'Bills'),
(575, 'Ma Belle', 150.00, 'Gas Bills'),
(600, 'Jon Cash', 350.00, 'Shopping');
Sign up to request clarification or add additional context in comments.

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.