JustinDB
JustinDB

Reputation: 1

Error in sql syntax while trying to perform query

 INSERT INTO `2018_players`(`p_id`, `player_fname`, `player_lname`, `stats_id`, `home_id`) VALUES (
  (1, 'LeBron', 'James', 2, 3, 23),
  (2, 'Stephen', 'Curry', 4, 5, 30),
  (3, 'James', 'Harden', 6, 7, 13),
  (4, 'Giannis', 'Antekokounmpo', 8, 9, 34),
  (5, 'Paul', 'George', 10, 11, 13);

Server version: 5.7.23

1 error were found during analysis.

#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 '' at line 7

Upvotes: 0

Views: 22

Answers (1)

Ryan Sparks
Ryan Sparks

Reputation: 1376

You are specifying 5 columns, but trying to insert 6 values per row, and there is an extra bracket after VALUES, you want something like:

 INSERT INTO `2018_players`(`p_id`, `player_fname`, `player_lname`, `stats_id`, `home_id`, `extra_column`) VALUES 
  (1, 'LeBron', 'James', 2, 3, 23),
  (2, 'Stephen', 'Curry', 4, 5, 30),
  (3, 'James', 'Harden', 6, 7, 13),
  (4, 'Giannis', 'Antekokounmpo', 8, 9, 34),
  (5, 'Paul', 'George', 10, 11, 13);

Upvotes: 1

Related Questions