Example SQL statements to create a comprehensive test structure

You need to create a storage group, database, table space, and table to use as a test structure for your SQL application.

The following SQL statements show how to create a complete test structure to contain a small table named SPUFINUM. The test structure consists of:

  • A storage group named SPUFISG
  • A database named SPUFIDB
  • A table space named SPUFITS in database SPUFIDB and using storage group SPUFISG
  • A table named SPUFINUM within the table space SPUFITS
CREATE STOGROUP SPUFISG
   VOLUMES (user-volume-number)
   VCAT DSNCAT ;
 
CREATE DATABASE SPUFIDB ;
 
CREATE TABLESPACE SPUFITS
   IN SPUFIDB
   USING STOGROUP SPUFISG ;
 
CREATE TABLE SPUFINUM
   ( XVAL CHAR(12) NOT NULL,
     ISFLOAT FLOAT,
     DEC30 DECIMAL(3,0),
     DEC31 DECIMAL(3,1),
     DEC32 DECIMAL(3,2),
     DEC33 DECIMAL(3,3),
     DEC10 DECIMAL(1,0),
     DEC11 DECIMAL(1,1),
     DEC150 DECIMAL(15,0),
     DEC151 DECIMAL(15,1),
     DEC1515 DECIMAL(15,15) )
   IN SPUFIDB.SPUFITS ;