Unix Technical Forum

newbie: syntax error in CREATE TABLE

This is a discussion on newbie: syntax error in CREATE TABLE within the MySQL forums, part of the Database Server Software category; --> Hello, I have installed MySQL, MySQL Administrator and MySQL QueryBrowser. I try to create table with MySQL Administrator entering ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-29-2008, 09:41 AM
r_ahimsa_m@poczta.onet.pl
 
Posts: n/a
Default newbie: syntax error in CREATE TABLE

Hello,
I have installed MySQL, MySQL Administrator and MySQL QueryBrowser. I try to
create table with MySQL Administrator entering table and column data. MySQL
Administrator generated SQL:

CREATE TABLE `rozgloszenia`.`clients` (
`client_id` INTEGER UNSIGNED CHARACTER SET utf8 COLLATE utf8_general_ci
NOT NULL AUTO_INCREMENT COMMENT 'Numer klienta',
`name` VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL
COMMENT 'Nazwa',
`email` VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci
COMMENT 'E-mail',
`phone` VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci
COMMENT 'Telefon',
`town` VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL
COMMENT 'Miejscowość',
PRIMARY KEY (`client_id`)
)
ENGINE = MyISAM
CHARACTER SET utf8 COLLATE utf8_general_ci
COMMENT = 'Nasi klienci';

The problem is that when I accept this SQL in MySQL Administrator I receive
error:

Error executing SQL commands to create table.
MySQL Error Nr. 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 'CHARACTER SET
utf8 COLLATE utf8_general_ci NOT NULL AUTO_INCREMENT COMMENT 'Nume' at line
2

I don't know what is wrong.

BTW, where I can find error descriptions by error codes?

/RAM/

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-29-2008, 09:41 AM
Rik Wasmus
 
Posts: n/a
Default Re: newbie: syntax error in CREATE TABLE

r_ahimsa_m@poczta.onet.pl wrote:
> Hello,
> I have installed MySQL, MySQL Administrator and MySQL QueryBrowser. I try to
> create table with MySQL Administrator entering table and column data. MySQL
> Administrator generated SQL:
>
> CREATE TABLE `rozgloszenia`.`clients` (
> `client_id` INTEGER UNSIGNED CHARACTER SET utf8 COLLATE utf8_general_ci
> NOT NULL AUTO_INCREMENT COMMENT 'Numer klienta',


> The problem is that when I accept this SQL in MySQL Administrator I receive
> error:
>
> Error executing SQL commands to create table.
> MySQL Error Nr. 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 'CHARACTER SET
> utf8 COLLATE utf8_general_ci NOT NULL AUTO_INCREMENT COMMENT 'Nume' at line
> 2
>
> I don't know what is wrong.


An INT column cannot have a character set AFAIK. if MySQL administrator
actually generates this, I'd suggest filing a bug report.

> BTW, where I can find error descriptions by error codes?


Someone invented a very handy service on the internet:
http://www.google.nl/search?q=mysql+error+codes

--
Rik Wasmus
....spamrun finished
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-29-2008, 09:41 AM
Peter H. Coffin
 
Posts: n/a
Default Re: newbie: syntax error in CREATE TABLE

On Wed, 28 May 2008 13:22:19 +0200, r_ahimsa_m@poczta.onet.pl wrote:
> Hello,
> I have installed MySQL, MySQL Administrator and MySQL QueryBrowser. I try to
> create table with MySQL Administrator entering table and column data. MySQL
> Administrator generated SQL:
>
> CREATE TABLE `rozgloszenia`.`clients` (
> `client_id` INTEGER UNSIGNED CHARACTER SET utf8 COLLATE utf8_general_ci
> NOT NULL AUTO_INCREMENT COMMENT 'Numer klienta',
> `name` VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL
> COMMENT 'Nazwa',
> `email` VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci
> COMMENT 'E-mail',
> `phone` VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci
> COMMENT 'Telefon',
> `town` VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL
> COMMENT 'Miejscowo??',
> PRIMARY KEY (`client_id`)
> )
> ENGINE = MyISAM
> CHARACTER SET utf8 COLLATE utf8_general_ci
> COMMENT = 'Nasi klienci';
>
> The problem is that when I accept this SQL in MySQL Administrator I receive
> error:
>
> Error executing SQL commands to create table.
> MySQL Error Nr. 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 'CHARACTER SET
> utf8 COLLATE utf8_general_ci NOT NULL AUTO_INCREMENT COMMENT 'Nume' at line
> 2
>
> I don't know what is wrong.


INTEGER doesn't take a CHARACTER SET. Nor a COLLATion. Though it would
be funny to see a 7 with an umlaut.

--
6. I will not gloat over my enemies' predicament before killing them.
--Peter Anspach's list of things to do as an Evil Overlord
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:56 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com