MYSQL 16
Book.sql Guest on 4th April 2021 04:34:38 AM
  1. -- The following SQL generates the database
  2. -- used by the 'book' example programs
  3. -- Copyright (C) 1992-2021Trolltech 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. forename varchar(40),
  14. surname varchar(40) );
  15.  
  16. title varchar(40),
  17. price numeric(10,2),
  18. authorid integer,
  19. notes varchar(255) );
  20.  
  21. create index book_authorid_idx on book( authorid );
  22.  
  23. CREATE TABLE sequence
  24. ( tablename varchar(10),
  25. sequence numeric);
  26.  
  27. INSERT INTO author VALUES ( 0, 'Philip K', 'Dick' );
  28. INSERT INTO author VALUES ( 1, 'Robert', 'Heinlein' );
  29. INSERT INTO author VALUES ( 2, 'Sarah', 'Paretsky' );
  30.  
  31. INSERT INTO book VALUES ( 0, 'The Man Who Japed', 6.99, 0, 'A good book' );
  32. INSERT INTO book VALUES ( 1, 'The Man in the High Castle', 9.99, 0, 'Worth reading' );
  33. INSERT INTO book VALUES ( 2, 'The Number of the Beast', 8.99, 1, 'Get this!' );
  34. INSERT INTO book VALUES ( 3, 'Indemnity Only', 9.99, 2, 'Cool' );
  35. INSERT INTO book VALUES ( 4, 'Burn Marks', 9.99, 2, 'Need to make notes' );
  36. INSERT INTO book VALUES ( 5, 'Deadlock', 9.99, 2, 'Hmmm..' );
  37.  
  38. INSERT INTO sequence VALUES ( 'author', 2 );
  39. INSERT INTO sequence VALUES ( 'book', 5 );

Paste-bin is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.