sqlsyntaxopenoffice-base

What is wrong with this SQL command for Apache Open Office Base?


I am an online student and have just started to learn SQL. I am doing an exercise where I have to create a new database with the following command in Apache Open Office 4.1.3.

CREATE TABLE "tbl_customers" ("customer_id" INTEGER IDENTITY, "first_name" VARCHAR(50), "last_name" VARCHAR(50), "phone" VARCHAR(25), "email" VARCHAR(30), PRIMARY KEY ( "customer_id"));

syntax error, unexpected NAME, expecting ')' or ','

This is a command that an instructor uses on her computer on the other side of the world, in the same version of Open Office, and it executes for her. I have uninstalled, restarted the computer and reinstalled the program, checked the commas and apostrophes, but whatever I try, it keeps giving me the above error.


Solution

  • It should work. Did you run the command by going to Tools -> SQL? Here are step by step instructions.

    1. Create a new Base file. For example from Writer, go to File -> New -> Database.
    2. Create a new database should be marked by default. This will use the HSQLDB 1.8 engine in an embedded setup (not good for real work, but okay for testing.)
    3. Press Next, then mark No, do not register the database. Or mark Yes if using it from Calc. Be sure that Open the database for editing is marked, then press Finish.
    4. Save as "New Database.odb" or give it a different name.
    5. Go to Tools -> SQL and paste the command. Then press Execute. execute
    6. Close and then go to View -> Refresh Tables to show the "tbl_customers" table.