DB2

DB2 Insert

DB2 supports the standard SQL syntax to insert rows:

insert into mytable (name, phone)
values ('nick', '123-456-7890');


Limiting query results in DB2

DB2 provides the FETCH FIRST command to limit query results.

select * from mytable fetch first 10 rows only;

To get the first 10 by column

          
  

DB2 Select

A select statement fetches data from database tables and stores the results in a table called resultset. Your SQL tool displays the contents of the resultset.


DB2 Comments

Comments are text written by developers to leave an explanation in the code. Comments are ignored by the database. DB2 supports two types of comments:

/* */
--

Example

          
  

DB2 Quick Guide

SQL Commands

Comments

/* */
--

Select

select co1, co2 from tbl where fld = 3;

DB2

A collection of articles on IBM's DB2 database