Categories
mysql oracle

Auto-increment column: differences in SQL syntax between Oracle and MySQL

I am a university student and need to submit a coursework using iSQL* Plus by Oracle.

I am trying to create a table with the following SQL Statement:

    CREATE  TABLE  Category 
( `id` INT(11) NOT NULL AUTO_INCREMENT ,
`title` VARCHAR (45) NULL ,
PRIMARY KEY (`id`) );

This results in the following message:

ORA-00911: invalid character

It’s referring to the tick ` sign. So I tried the following, using a single quote instead:

    CREATE  TABLE  Category 
( 'id' INT(11) NOT NULL AUTO_INCREMENT ,
'title' VARCHAR (45) NULL ,
PRIMARY KEY ('id') );

The error:

ORA-00904: : invalid identifier

So one more try with ” – The Error:

( "id" INT(11) NOT NULL AUTO_INCREMENT ,
*

ORA-00907: missing right parenthesis

If I remove the (11) behind the INT it will complaint about the AUTO_INCREMENT attribute.

    CREATE  TABLE  Category 
( "id" INT NOT NULL AUTO_INCREMENT ,
"title" VARCHAR (45) NULL ,
PRIMARY KEY ("id") );

I thought SQL is SQL and there are not really differences on these very basic levels. I thought that things are getting different on deeper levels?

  • how I get my statement working?
  • what would you recommend for someone familiar with MySQL to learn Oracle?