| 1 | -- The following SQL generates the database
|
|---|
| 2 | -- used by the 'book' example programs
|
|---|
| 3 | -- Copyright (C) 1992-2001 Trolltech AS. All rights reserved.
|
|---|
| 4 | --
|
|---|
| 5 | -- This file is part of an example program for Qt. This example
|
|---|
| 6 | -- program may be used, distributed and modified without limitation.
|
|---|
| 7 |
|
|---|
| 8 | DROP TABLE author;
|
|---|
| 9 | DROP TABLE book;
|
|---|
| 10 | DROP TABLE sequence;
|
|---|
| 11 |
|
|---|
| 12 | CREATE TABLE author
|
|---|
| 13 | ( id integer primary key,
|
|---|
| 14 | forename varchar(40),
|
|---|
| 15 | surname varchar(40) );
|
|---|
| 16 |
|
|---|
| 17 | CREATE TABLE book
|
|---|
| 18 | ( id integer primary key,
|
|---|
| 19 | title varchar(40),
|
|---|
| 20 | price numeric(10,2),
|
|---|
| 21 | authorid integer,
|
|---|
| 22 | notes varchar(255) );
|
|---|
| 23 |
|
|---|
| 24 | create index book_authorid_idx on book( authorid );
|
|---|
| 25 |
|
|---|
| 26 | CREATE TABLE sequence
|
|---|
| 27 | ( tablename varchar(10),
|
|---|
| 28 | sequence numeric);
|
|---|
| 29 |
|
|---|
| 30 | INSERT INTO author VALUES ( 0, 'Philip K', 'Dick' );
|
|---|
| 31 | INSERT INTO author VALUES ( 1, 'Robert', 'Heinlein' );
|
|---|
| 32 | INSERT INTO author VALUES ( 2, 'Sarah', 'Paretsky' );
|
|---|
| 33 |
|
|---|
| 34 | INSERT INTO book VALUES ( 0, 'The Man Who Japed', 6.99, 0, 'A good book' );
|
|---|
| 35 | INSERT INTO book VALUES ( 1, 'The Man in the High Castle', 9.99, 0, 'Worth reading' );
|
|---|
| 36 | INSERT INTO book VALUES ( 2, 'The Number of the Beast', 8.99, 1, 'Get this!' );
|
|---|
| 37 | INSERT INTO book VALUES ( 3, 'Indemnity Only', 9.99, 2, 'Cool' );
|
|---|
| 38 | INSERT INTO book VALUES ( 4, 'Burn Marks', 9.99, 2, 'Need to make notes' );
|
|---|
| 39 | INSERT INTO book VALUES ( 5, 'Deadlock', 9.99, 2, 'Hmmm..' );
|
|---|
| 40 |
|
|---|
| 41 | INSERT INTO sequence VALUES ( 'author', 2 );
|
|---|
| 42 | INSERT INTO sequence VALUES ( 'book', 5 );
|
|---|