Find admissions within 30-days
Find all ancestor parts for part '1aCx'.
SQL to create an example assembly table
Example traveling salesman query
Example sample data file (need to run load statement to load data into the table)
IBM Stock Price Window Queries
1. Download IBM stock price data:
https://finance.yahoo.com/quote/ibm/history/
A example dataset is downloaded here.
2. Create a table for the data using the SQL script.
3. Run two windows queries.
JDBC Example
Example SQL to create a table
Example Java code to test JDBC (or download here)
To find DB2 service port number:
On Linux: /etc/services: service_name 50001/tcp # Connection port for DB2 instance instance
On Windows: c:\Windows/system32/drivers/etc/services: db2c_DB2 50000/tcp
(25000 for latest version on Windows)
SQL PL Examples
Example UDF in SQL PL
This is a dummy UDF to add two integers together. You can test it by running: db2 -td@ -f testadd.sql. Note that sysibm.sysdummy1 is a dummy table of DB2 with a single record, similar as Oracle's dual table, and often used for testing purpose.
Download testadd.sql; View source
Example stored procedure in SQL PL
Example stored procedures in SQL PL
Stored Procedure in Java
UDF in PL/SQL
Reverse a string
Define a table function that returns the employees in a specified department number.
Array
Example User Defined Aggregate Function
Spatial Query Examples
Hadoop Setup
XQuery Examples
Temporal Query Examples