Tutorial by Examples

CREATE DATABASE SAMPLEDB; This will create a new database called sampledb.
CONNECT TO SAMPLEDB; From the command line (db2clp, terminal, db2cmd) you can write: db2 CONNECT TO SAMPLEDB
The following statement will create a new table called employee: CREATE TABLE EMPLOYEE ( EMPNO CHAR(6) NOT NULL, FIRSTNME VARCHAR(12) NOT NULL, LASTNAME VARCHAR(15) NOT NULL, SALARY DECIMAL(9,2) , PRIMARY KEY (EMPNO) ...
Let's suppose we are going to insert rows in the previously created table. We can explicitly name the columns we are going to out values is and its order: INSERT INTO EMPLOYEE (EMPNO, FIRSTNME, LASTNAME, SALARY) VALUES ( '123456', 'Ali', 'Veli', 100000); If we know the order and we are going...
SELECT 'HELLO WORLD' FROM SYSIBM.SYSDUMMY1; 1 ----------- Hello World 1 record(s) selected. "The SYSIBM.SYSDUMMY1 table contains one row. The table is used for SQL statements in which a table reference is required, but the contents of the table are not important"...

Page 1 of 1