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

问题描述

INSERT INTO movie (id, title, desc, released, views, featured) VALUES ('', 'title', '
\r\n    description
\r\n', '2006-12-12', '0', '0')

错误是

表结构为

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中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 23:03