The SAMPLE database provided with DB2 on LUW can be created by using one of two methods:
The default schema used for tables in the database will be the user ID you used to log in to the operating system (on Windows, this will be the user ID used to install DB2, and on UNIX, the instance user ID).
You can also create the SAMPLE database from the command line. Included with DB2 is a program called db2sampl that will create and populate the database for you. This program can be found in the bin subdirectory of the directory where db2 was installed. For the purpose of running the examples presented in this book, foreign key constraints are required. The db2sampl program can be executed with an option to also create the primary keys, such as this:
For reference, Figure F.2 shows the DDL for the SAMPLE database. You can use this DDL to create the tables for the SAMPLE database; however, they will not contain any data. Running the db2sampl program will also populate the tables with sample data.
In addition to the SAMPLE database tables, you still need to create a few other tables to ensure that you can run every example shown in this publication. Figure F.3 provides the DDL for the additional tables. You should create these tables using the same schema used to create the SAMPLE database tables.