#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    3
    Rep 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?
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    7
    Rep Power
    0
    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
  4. #3
  5. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,143
    Rep Power
    4274
    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
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    7
    Rep Power
    0
    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
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    3
    Rep Power
    0
    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
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    3
    Rep 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?
  12. #7
  13. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,143
    Rep Power
    4274
    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
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

IMN logo majestic logo threadwatch logo seochat tools logo