List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:April 15 2008 2:27pm
Subject:Re: Create table
View as plain text  
At 10:32 AM +0530 4/15/08, Krishna Chandra Prajapati wrote:
>Hi,
>
>I have created a table name group.
>
>CREATE TABLE `group` (
>   `group_id` int(11) NOT NULL,
>   `group_name` varchar(128) NOT NULL,
>   `date_created` datetime NOT NULL,
>   `created_by` int(11) NOT NULL,
>   `modified_by` int(11) default NULL,
>   `status` char(1) NOT NULL default 'Y',
>   PRIMARY KEY  (`group_id`)
>) ENGINE=MyISAM DEFAULT CHARSET=latin1;
>
>The table was successfully created without any errors.
>After that when i try to describe it. Its giving error.
>
>mysql> desc group;
>ERROR 1064 (42000): 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
>mysql> drop table group;
>ERROR 1064 (42000): 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
>
>Does the problem is with table name.

"group" is a reserved word.  See this page:

http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html

The page also describes how to quote identifiers to avoid
this problem.

-- 
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com
Thread
Create tableKrishna Chandra Prajapati15 Apr
  • Re: Create tableAnanda Kumar15 Apr
  • Re: Create tableCarlos Proal15 Apr
  • Re: Create tablePaul DuBois15 Apr
  • Re: Create tableVelen15 Apr
Re: Create tableRob Wultsch15 Apr