Basic Commands

Create Instance
DB2ICRT DB2ICRT DEMO

Drop Instance
DB2IDROP DB2IDROP DEMO

List Instances
DB2ILIST

Set Instance
SET DB2INSTANCE= SET DB2INSTANCE=DEMO

Get Current Instance
GET INSTANCE The current database manager instance is: DEMO

Start Instance
DB2START SQL1063N DB2START processing was successful.

Stop Instance
DB2STOP SQL1064N DB2STOP processing was successful.

Create Database
CREATE DATABASE TEST

Create Sample Database
db2sampl Creating database "SAMPLE"... Connecting to database "SAMPLE"...  Creating tables and data in schema "ADMINISTRATOR"...  Creating tables with XML columns and XML data in schema "ADMINISTRATOR"...  'db2sampl' processing complete.

Connect To Database
CONNECT TO SAMPLE Database Connection Information Database server       = DB2/NT 9.7.0 SQL authorization ID  = ADMINISTRATOR Local database alias  = SAMPLE

Reset the Connection
CONNECT RESET

Create Table
CREATE TABLE t1 (col1 INTEGER, col2 VARCHAR(10))

Insert
INSERT INTO t1 VALUES(1, 'DB29.5'),(2, 'DB29.7')

Drop Table
DROP TABLE t1;

Create Index
CREATE INDEX id1 on t1(col1)

Drop Index
DROP INDEX id1

Select from table
SELECT * FROM t1 COL1       COL2 --- --         1 DB29.5 2 DB29.7 2 record(s) selected.

List all schemas in database
SELECT * FROM SYSCAT.SCHEMATA