- Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathexample.sql
More file actions
Latest commit
30 lines (27 loc) · 903 Bytes
/
Copy pathexample.sql
File metadata and controls
30 lines (27 loc) · 903 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
DROPTABLE IF EXISTS test.documents;
CREATETABLEtest.documents
(
id INTEGERPRIMARY KEYNOT NULL AUTO_INCREMENT,
group_id INTEGERNOT NULL,
group_id2 INTEGERNOT NULL,
date_added DATETIME NOT NULL,
title VARCHAR(255) NOT NULL,
content TEXTNOT NULL
);
REPLACE INTO test.documents ( id, group_id, group_id2, date_added, title, content ) VALUES
( 1, 1, 5, NOW(), 'test one', 'this is my test document number one. also checking search within phrases.' ),
( 2, 1, 6, NOW(), 'test two', 'this is my test document number two' ),
( 3, 2, 7, NOW(), 'another doc', 'this is another group' ),
( 4, 2, 8, NOW(), 'doc number four', 'this is to test groups' );
DROPTABLE IF EXISTS test.tags;
CREATETABLEtest.tags
(
docid INTEGERNOT NULL,
tagid INTEGERNOT NULL,
UNIQUE(docid,tagid)
);
INSERT INTOtest.tagsVALUES
(1,1), (1,3), (1,5), (1,7),
(2,6), (2,4), (2,2),
(3,15),
(4,7), (4,40);