不能使用列名“desc"在 mysql [英] Can't use column name "desc" in mysql

查看:20
本文介绍了不能使用列名“desc"在 mysql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

INSERT INTO movie (id, title, desc, released, views, featured) VALUES ('', 'title', '

    description

', '2006-12-12', '0', '0')

错误是

1064 - 您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册以了解要使用的正确语法靠近 'desc、released、views、featured) VALUES ('', 'title', ' 说明 ', ' 在第 1 行

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 'desc, released, views, featured) VALUES ('', 'title', ' description ', ' at line 1

表结构是

id [ (pk, auto_inc) int(11) ]
title [ varchar(256) ]
desc [ text ]
released [ date ]
views [ int(11) ]
featured [ int(11) ]

在 phpmyadmin sql 编辑器中运行

running in phpmyadmin sql editor

推荐答案

desc 是一个 mysql 保留字.您必须对保留字的列使用反引号``.

desc is a mysql reserved word. you must use backticks `` with the columns which are reserved words.

INSERT INTO movie (id, title, `desc`, released, views, featured)...

您应该避免使用保留字作为列名或必须使用反引号 (``)

You should avoid using reserved words as column name or must use backticks (``)

这篇关于不能使用列名“desc"在 mysql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆