The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Databases
> MySQL Help
|
Create Table, MYSQL 5.5, Syntax Error
Discuss Create Table, MYSQL 5.5, Syntax Error in the MySQL Help forum on Dev Shed. Create Table, MYSQL 5.5, Syntax Error MySQL Help forum discussing administration, SQL syntax, and other MySQL-related topics. MySQL is an open-source relational database management system (RDBMS).
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

March 4th, 2013, 02:37 PM
|
|
Registered User
|
|
Join Date: Mar 2013
Posts: 3
Time spent in forums: 40 m 38 sec
Reputation Power: 0
|
|
|
Create Table, MYSQL 5.5, Syntax Error
I am a complte Newbie to Ubuntu and MySQL.
I have manged to Instal Ubuntu, MYSQL Server and MYSQL Navigator.
Using Navigator I am attempting to create a table.
I get Syntax Error
The SQl generated by MYSQL Navigator is:
CREATE TABLE MyTable (
Field1 TINYINT NULL,
Field2 TINYINT NULL
) TYPE = MyISAM COMMENT ='';
Can anyone give me any assistance? 
|

March 5th, 2013, 01:45 AM
|
|
Registered User
|
|
Join Date: Mar 2013
Posts: 7
Time spent in forums: 1 h 56 m 12 sec
Reputation Power: 0
|
|
Quote: | Originally Posted by BoldonKen I am a complte Newbie to Ubuntu and MySQL.
I have manged to Instal Ubuntu, MYSQL Server and MYSQL Navigator.
Using Navigator I am attempting to create a table.
I get Syntax Error
The SQl generated by MYSQL Navigator is:
CREATE TABLE MyTable (
Field1 TINYINT NULL,
Field2 TINYINT NULL
) TYPE = MyISAM COMMENT ='';
Can anyone give me any assistance?  |
What error do you get?
Try this:
CREATE TABLE `mytable` (
`field1` tinyint(4) DEFAULT NULL,
`field2` tinyint(4) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
I think your error lies in that you have not defined the range of tinyint
And since you are a newcomer to mysql i would suggest that u use some kind of frontend/gui to access mysql, e.g. Tora or squirrel or even Heidi sql
Nicolai
|

March 5th, 2013, 03:55 AM
|
 |
SQL Consultant
|
|
Join Date: Feb 2003
Location: Toronto Canada
|
|
Quote: | Originally Posted by vestlink I think your error lies in that you have not defined the range of tinyint | sorry, no
the (4) is an optional designator which indicates how many digits to print when you are using ZEROFILL
the range of TINYINT (as with all integer columns) is predefined
original poster did not actually say what the error message was, but i'm going to guess it's cause by using TYPE instead of ENGINE
|

March 5th, 2013, 04:04 AM
|
|
Registered User
|
|
Join Date: Mar 2013
Posts: 7
Time spent in forums: 1 h 56 m 12 sec
Reputation Power: 0
|
|
Quote: | Originally Posted by r937 sorry, no
the (4) is an optional designator which indicates how many digits to print when you are using ZEROFILL
the range of TINYINT (as with all integer columns) is predefined
original poster did not actually say what the error message was, but i'm going to guess it's cause by using TYPE instead of ENGINE |
Ok. I also learned something new today :-) thnx
Nicolai
|

March 5th, 2013, 10:42 AM
|
|
Registered User
|
|
Join Date: Mar 2013
Posts: 3
Time spent in forums: 40 m 38 sec
Reputation Power: 0
|
|
Quote: | Originally Posted by r937 sorry, no
the (4) is an optional designator which indicates how many digits to print when you are using ZEROFILL
the range of TINYINT (as with all integer columns) is predefined
original poster did not actually say what the error message was, but i'm going to guess it's cause by using TYPE instead of ENGINE |
Sorry, I did say the error was "Syntax Error", the message was slightly longer, it actually said "Syntax Error near TYPE"
As I explained I was using MYSQL Navigator to generate the SQL, the parameter folllowing TYPE is chosen from a Combobox list.
I am not actually at my Ubuntu box / MYSQL Server box at the moment, I will try your suggestions and respond ASAP.
Thank You
|

March 5th, 2013, 12:35 PM
|
|
Registered User
|
|
Join Date: Mar 2013
Posts: 3
Time spent in forums: 40 m 38 sec
Reputation Power: 0
|
|
|
OK, I changed the SQL to say ENGINE instead of TYPE, and it worked.
So, first of all thank you for that.
Am I being silly by asking, "why does MySQL's own GUI tool produce the wrong SQL?
|

March 5th, 2013, 12:56 PM
|
 |
SQL Consultant
|
|
Join Date: Feb 2003
Location: Toronto Canada
|
|
Quote: | Originally Posted by BoldonKen Am I being silly by asking, "why does MySQL's own GUI tool produce the wrong SQL? | no, you are not
TYPE used to be valid in early versions of mysql
perhaps you have an early version of navigator
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|