首页 > 解决方案 > MYSQL, not valid at this position, expecting an identifier

问题描述

I am struggling my head around days to get rid of this error, but still in vain. I already search SO before posting the error, but none of them helped me. Snapshot

Picture with error message

Here is my query

SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE groups;

SET FOREIGN_KEY_CHECKS = 1;

I double checked the the table group exist

Edit: Just found out that groups is a reserved keyword in MySQL, so is there anyway for me to truncate the table groups

标签: mysqlsql

解决方案


正如编辑中所写,这groups是 MySQL 中的保留字,所以我不得不使用这样的语法

TRUNCATE `groups`

为了使它工作。


推荐阅读