lundi 13 juin 2016

How to fix MySQL Error #1064?

I have a very simple database including 2 tables, like this

CREATE TABLE `group` (
  `id_group` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) DEFAULT NULL,
   PRIMARY KEY (`id_group`)
   ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
INSERT INTO `group` VALUES (1,'Groupe 1'),(2,'Groupe 2'),(3,'Groupe 3');

CREATE TABLE `user` (
 `id_user` int(11) NOT NULL AUTO_INCREMENT,
 `username` varchar(45) DEFAULT NULL,
 `password` varchar(255) DEFAULT NULL,
 `last_login` datetime DEFAULT NULL,
  PRIMARY KEY (`id_user`)
 ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

INSERT INTO `user` VALUES (1,'test','test','2011-09-28 12:00:00');

But when I taped in mySQL server

select * from group

It gave me this:

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

with table "user", it works all right.

Aucun commentaire:

Enregistrer un commentaire