-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDatabase.sql
More file actions
38 lines (30 loc) · 1014 Bytes
/
Copy pathDatabase.sql
File metadata and controls
38 lines (30 loc) · 1014 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
31
32
33
34
35
36
37
38
create table Lexicon(
WordID mediumint unsigned auto_increment,
Word varchar(50),
constraint primary key pk (WordID)
);
create table Indexes(
PageID mediumint unsigned,
WordID mediumint unsigned,
Position mediumint unsigned,
Priority tinyint unsigned,
constraint pk primary key (pageID, WordID, Position)
);
create table Pages(
PageID mediumint unsigned auto_increment,
URL varchar(500),
constraint pk primary key (pageID)
);
create table Citations(
PageID mediumint unsigned,
CitationID mediumint unsigned,
constraint pk primary key (pageID, CitationID)
);
alter table indexes
add constraint fk foreign key (pageID) references Pages(PageID);
alter table indexes
add constraint fk2 foreign key (WordID) references Lexicon(WordID);
alter table citations
add constraint fk3 foreign key (pageID) references Pages(PageID);
alter table citations
add constraint fk4 foreign key (CitationID) references Pages(PageID);