1 create table reference_types (
2 reference_type_id integer primary key,
3 type_label varchar(50) default null,
4 abbreviation varchar(50) default null,
5 description varchar(50) default null
8 create table reference_codes (
9 reference_type_id int(11),
10 reference_code int(11) not null,
11 code_label varchar(50) default null,
12 abbreviation varchar(50) default null,
13 description varchar(50) default null,
14 primary key (reference_type_id, reference_code)
17 create table products (
18 id int(11) not null primary key,
19 name varchar(50) default null
22 create table tariffs (
23 tariff_id int(11) not null,
24 start_date date not null,
25 amount integer(11) default null,
26 primary key (tariff_id, start_date)
29 create table product_tariffs (
30 product_id int(11) not null,
31 tariff_id int(11) not null,
32 tariff_start_date date not null,
33 primary key (product_id, tariff_id, tariff_start_date)
36 create table suburbs (
37 city_id int(11) not null,
38 suburb_id int(11) not null,
39 name varchar(50) not null,
40 primary key (city_id, suburb_id)
43 create table streets (
44 id integer not null primary key autoincrement,
45 city_id int(11) not null,
46 suburb_id int(11) not null,
47 name varchar(50) not null
51 id integer not null primary key autoincrement,
52 name varchar(50) not null
55 create table articles (
56 id integer not null primary key autoincrement,
57 name varchar(50) not null
60 create table readings (
61 id integer not null primary key autoincrement,
62 user_id int(11) not null,
63 article_id int(11) not null,
64 rating int(11) not null
68 id integer not null primary key autoincrement,
69 name varchar(50) not null
72 create table memberships (
74 group_id int not null,
75 primary key (user_id, group_id)
78 create table membership_statuses (
79 id integer not null primary key autoincrement,
81 group_id int not null,
82 status varchar(50) not null
85 create table departments (
86 department_id integer not null,
87 location_id integer not null,
88 primary key (department_id, location_id)
91 create table employees (
92 id integer not null primary key autoincrement,
93 department_id integer null,
94 location_id integer null
97 create table comments (
98 id integer not null primary key autoincrement,
99 person_id varchar(100) null,
100 person_type varchar(100) null,
101 hack_id varchar(100) null
105 name varchar(50) not null primary key
108 create table kitchen_sinks (
109 id_1 integer not null,
110 id_2 integer not null,
112 a_string varchar(100),
113 primary key (id_1, id_2)
116 create table restaurants (
117 franchise_id integer not null,
118 store_id integer not null,
120 primary key (franchise_id, store_id)
123 create table restaurants_suburbs (
124 franchise_id integer not null,
125 store_id integer not null,
126 city_id integer not null,
127 suburb_id integer not null
131 id integer not null primary key autoincrement
135 dorm_id integer not null,
136 room_id integer not null,
137 primary key (dorm_id, room_id)
140 create table room_attributes (
141 id integer not null primary key autoincrement,
145 create table room_attribute_assignments (
146 dorm_id integer not null,
147 room_id integer not null,
148 room_attribute_id integer not null
151 create table students (
152 id integer not null primary key autoincrement
155 create table room_assignments (
156 student_id integer not null,
157 dorm_id integer not null,
158 room_id integer not null