-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtables.txt
More file actions
105 lines (102 loc) · 2.34 KB
/
tables.txt
File metadata and controls
105 lines (102 loc) · 2.34 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
drop table if exists demeritNotices;
drop table if exists tickets;
drop table if exists registrations;
drop table if exists vehicles;
drop table if exists marriages;
drop table if exists births;
drop table if exists persons;
drop table if exists payments;
drop table if exists users;
PRAGMA foreign_keys = ON;
create table persons (
fname char(12),
lname char(12),
bdate date,
bplace char(20),
address char(30),
phone char(12),
primary key (fname, lname)
);
create table births (
regno int,
fname char(12),
lname char(12),
regdate date,
regplace char(20),
gender char(1),
f_fname char(12),
f_lname char(12),
m_fname char(12),
m_lname char(12),
primary key (regno),
foreign key (fname,lname) references persons,
foreign key (f_fname,f_lname) references persons,
foreign key (m_fname,m_lname) references persons
);
create table marriages (
regno int,
regdate date,
regplace char(20),
p1_fname char(12),
p1_lname char(12),
p2_fname char(12),
p2_lname char(12),
primary key (regno),
foreign key (p1_fname,p1_lname) references persons,
foreign key (p2_fname,p2_lname) references persons
);
create table vehicles (
vin char(5),
make char(10),
model char(10),
year int,
color char(10),
primary key (vin)
);
create table registrations (
regno int,
regdate date,
expiry date,
plate char(7),
vin char(5),
fname char(12),
lname char(12),
primary key (regno),
foreign key (vin) references vehicles,
foreign key (fname,lname) references persons
);
create table tickets (
tno int,
regno int,
fine int,
violation text,
vdate date,
primary key (tno),
foreign key (regno) references registrations
);
create table demeritNotices (
ddate date,
fname char(12),
lname char(12),
points int,
desc text,
primary key (ddate,fname,lname),
foreign key (fname,lname) references persons
);
create table payments (
tno int,
pdate date,
amount int,
primary key (tno, pdate),
foreign key (tno) references tickets
);
create table users (
uid char(8),
pwd char(8),
utype char(1), -- 'a' for agents, 'o' for officers
fname char(12),
lname char(12),
city char(15),
primary key(uid),
foreign key (fname,lname) references persons
);