Previous Topic Next topic Print topic


To create an empty table and grant access privileges to other users

  1. Run your database query tool.

    The program will pause to accept an SQL command.

  2. Enter the following (italics indicate variable names, non-italics are SQL reserved words):
    CREATE TABLE newtab (col1 CHAR(30), col2 CHAR(11)) 
    
    The program will pause to accept an SQL command.
  3. Now enter the following command:
    GRANT ALL PRIVILEGES ON newtab TO PUBLIC

    The program will pause to accept an SQL command.

  4. Now enter:
    CREATE UNIQUE INDEX newtab_index ON newtab (col1) 
  5. Next, press Enter again to exit the program.
Note:

When naming columns and tables, make sure to use underscores ("_"), not hyphens ("-"), or a syntax error will result.

The above entries will create a new table and grant access permission to everyone. If you want to delete the table you created, enter the following command:

DROP TABLE newtab  
Previous Topic Next topic Print topic