Rational Developer for System z


Create a schema and database table

This lesson describes how to create a schema and a sample database table for the DB2® application.
A schema is a logical grouping for your database artifacts. You may already have a schema, but if you do not you will need to do one of the following actions

To create a schema and database table, do these steps:

  1. In the Data Source Explorer, expand your database connection, click the database icon, and select New SQL Script from the pop-up menu. The SQL script editor opens.
  2. In the SQL script editor, type the following SQL statement, which creates the schema and database table. Replace USERID with your database user ID.
    CREATE TABLE USERID.FRIENDZ (
    		FNAME CHAR(10) NOT NULL,
    		LNAME CHAR(10) NOT NULL,
    		PHONE CHAR(10) NOT NULL,
    		EMAIL CHAR(30) NOT NULL
    	)
    	AUDIT NONE
    	DATA CAPTURE NONE
    	CCSID EBCDIC;
  3. To run the SQL statement, right-click the white space of the edit session and select Run SQL from the pop-up menu. You should see the following result in the SQL Results view:
    Result of CREATE TABLE statement
  4. In the Data Source Explorer, expand the database connection until you see the Schemas folder. Right-click the Schemas folder and click Refresh.
  5. Expand the Schemas folder and scroll until you see the RDZSCHE folder.
  6. Expand the RDZSCHE folder to see the Tables folder.
  7. Expand the Tables folder to see the FRIENDZ table.

Feedback