------- book cover ------- Database System Concepts
Sixth Edition
Avi Silberschatz
Henry F. Korth
S. Sudarshan

line separator

We provide below the DDL and sample data for the tables in the university that we use in our text, with one change: instead of using the time data type, which is not supported on some databases such as Oracle, we split start_time into start_hr and start_min, and end_time into end_hr and end_min, which are integer types. If the database you use supports the time type, and you wish to use it, you can modify the DDL and the sample data files accordingly.

- DDL (use this the first time), DDL with drop table (use this if you wish to recreate the database after dropping existing tables)

- SQL code for creating small relations
The file smallRelationsInsertFile.sql contains data that matches Appendix A exactly. The file contains SQL insert statements to load data into all the tables, after first deleting any data that the tables currently contain.
The data include students taking courses outside their department, and instructors teaching courses outside their department; this helps detect errors in natural join specifications that accidentally equate department names of students or instructors with department names of courses.

- SQL code for creating large relations
The file largeRelationsInsertFile.sql contains SQL insert statements for larger, randomly created relations for a truly strange university (since course titles and department names are chosen randomly).
The sizes of the relations are as follows:
department 20
instructor 50
student 2000
course 200
prereq 100
section 100
time_slot 20
teaches 100
takes 30000
advisor 2000

- tableGen.java
The file tableGen.java contains a Java program for generating the largeRelations data. Be warned that some versions of the eclipse Java compiler lack the java.util.Scanner class that this program uses; if you run into a problem compiling this program, we suggest you upgrade to the latest version of the eclipse Java compiler, or use the Sun Java compiler instead.
line separator