What can cause legit MySql INSERT INTO command to fail?
        Posted  
        
            by Makis
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Makis
        
        
        
        Published on 2010-04-18T15:24:42Z
        Indexed on 
            2010/04/18
            15:33 UTC
        
        
        Read the original article
        Hit count: 463
        
mysql
|mysql-query
I can't figure out what's causing my INSERT INTO's to fail to certain table in MySql. I can manage them to other tables. The table looks like:
CREATE TABLE IF NOT EXISTS `Match` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `match_no` int(11) NOT NULL,
  `season` int(11) NOT NULL,
  `hometeam` int(11) NOT NULL,
  `awayteam` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `match_no` (`match_no`),
  KEY `season` (`season`),
  KEY `hometeam` (`hometeam`),
  KEY `awayteam` (`awayteam`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
And the command is
INSERT INTO Match (`match_no`, `season`, `hometeam`, `awaytem`) VALUES (1, 1, 2, 3)
All I get is:
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 'Match (match_no, season, hometeam, awaytem) VALUES (1, 1, 2, 3)' at line 1
I have checked the manual and half-a-dozen examples from the web and whatnought and tried all sorts of changes to the syntax in case there is some MySql specific oddity, but nothing seems to work.
© Stack Overflow or respective owner