example.sql 903 B

123456789101112131415161718192021222324252627282930
  1. DROP TABLE IF EXISTS test.documents;
  2. CREATE TABLE test.documents
  3. (
  4. id INTEGER PRIMARY KEY NOT NULL AUTO_INCREMENT,
  5. group_id INTEGER NOT NULL,
  6. group_id2 INTEGER NOT NULL,
  7. date_added DATETIME NOT NULL,
  8. title VARCHAR(255) NOT NULL,
  9. content TEXT NOT NULL
  10. );
  11. REPLACE INTO test.documents ( id, group_id, group_id2, date_added, title, content ) VALUES
  12. ( 1, 1, 5, NOW(), 'test one', 'this is my test document number one. also checking search within phrases.' ),
  13. ( 2, 1, 6, NOW(), 'test two', 'this is my test document number two' ),
  14. ( 3, 2, 7, NOW(), 'another doc', 'this is another group' ),
  15. ( 4, 2, 8, NOW(), 'doc number four', 'this is to test groups' );
  16. DROP TABLE IF EXISTS test.tags;
  17. CREATE TABLE test.tags
  18. (
  19. docid INTEGER NOT NULL,
  20. tagid INTEGER NOT NULL,
  21. UNIQUE(docid,tagid)
  22. );
  23. INSERT INTO test.tags VALUES
  24. (1,1), (1,3), (1,5), (1,7),
  25. (2,6), (2,4), (2,2),
  26. (3,15),
  27. (4,7), (4,40);