HP 3000 Manuals

Creating Tables [ Up and Running with ALLBASE/SQL ] MPE/iX 5.0 Documentation


Up and Running with ALLBASE/SQL

Creating Tables 

Now get ready to create some tables for MUSICDBE. Before doing this step,
you need to analyze the data that is to be stored.  In the next
paragraphs, assume that, using the suggestions in chapter 2, you have
already arrived at the following table design:

                      Albums Table 
AlbumCode             INTEGER NOT NULL
AlbumTitle            VARCHAR(40)
Medium                CHAR(2)
AlbumCost             DECIMAL(6,2)
RecordingCo           CHAR(10) NOT NULL
DateRecorded          DATE
MfgCode               VARCHAR(40)
Comment               VARCHAR(80)

                      Titles Table 
AlbumCode             INTEGER NOT NULL
Selection             VARCHAR(40) NOT NULL
Timing                INTERVAL
Composer              VARCHAR(40)
Performers            VARCHAR(40)
Comment               VARCHAR(80)

Now, you need to create each of these tables.

Creating the Albums Table 

Use the following command to create the Albums table:

     isql=> CREATE PUBLIC TABLE Albums Return 
     > (AlbumCode INTEGER NOT NULL, Return 
     > AlbumTitle VARCHAR(40) NOT NULL, Return 
     > Medium CHAR(2), Return 
     > AlbumCost DECIMAL(6,2), Return 
     > RecordingCo CHAR(10) NOT NULL, Return 
     > DateRecorded DATE, Return 
     > MfgCode VARCHAR(40), Return 
     > Comment VARCHAR(80)) Return 
     > IN ALBUMFS; Return 

Did the command complete without errors?  If not, did you do the
following:

   *   Use a semicolon at the end?
   *   Include a final close parenthesis?
   *   Use valid data types and sizes?

Use the ISQL REDO command to examine and correct your command, then issue
it again.  (For help with REDO, type HELP REDO at the isql=> prompt.

When the command completes without errors, use the COMMIT WORK command to
make it permanent.


NOTE You created the Albums table as a PUBLIC table, which means that other users of the DBEnvironment need no special authorization to access the table.
Creating the Titles Table Now, create the second table: isql=> CREATE PUBLIC TABLE Titles Return > (AlbumCode INTEGER NOT NULL, Return > Selection VARCHAR(40) NOT NULL, Return > Composer CHAR(40), Return > Timing INTERVAL, Return > Performers VARCHAR(40), Return > Comment VARCHAR(80)) Return > IN ALBUMFS; Return If the command completes without errors, use the COMMIT WORK command.
[]


MPE/iX 5.0 Documentation