1 create table reference_types (
 
   2     reference_type_id int(11) not null auto_increment,
 
   3     type_label varchar(50) default null,
 
   4     abbreviation varchar(50) default null,
 
   5     description varchar(50) default null,
 
   6     primary key (reference_type_id)
 
   9 create table reference_codes (
 
  10     reference_type_id int(11),
 
  11     reference_code int(11) not null,
 
  12     code_label varchar(50) default null,
 
  13     abbreviation varchar(50) default null,
 
  14     description varchar(50) default null,
 
  15     primary key (reference_type_id, reference_code)
 
  18 create table products (
 
  19     id int(11) not null auto_increment,
 
  20     name varchar(50) default null,
 
  24 create table tariffs (
 
  25     tariff_id int(11) not null,
 
  26     start_date date not null,
 
  27     amount integer(11) default null,
 
  28     primary key (tariff_id, start_date)
 
  31 create table product_tariffs (
 
  32     product_id int(11) not null,
 
  33     tariff_id int(11) not null,
 
  34     tariff_start_date date not null,
 
  35     primary key (product_id, tariff_id, tariff_start_date)
 
  38 create table suburbs (
 
  39     city_id int(11) not null,
 
  40     suburb_id int(11) not null,
 
  41     name varchar(50) not null,
 
  42     primary key (city_id, suburb_id)
 
  45 create table streets (
 
  46     id int(11) not null auto_increment,
 
  47     city_id int(11) not null,
 
  48     suburb_id int(11) not null,
 
  49     name varchar(50) not null,
 
  54     id int(11) not null auto_increment,
 
  55     name varchar(50) not null,
 
  59 create table articles (
 
  60     id int(11) not null auto_increment,
 
  61     name varchar(50) not null,
 
  65 create table readings (
 
  66     id int(11) not null auto_increment,
 
  67     user_id int(11) not null,
 
  68     article_id int(11) not null,
 
  69     rating int(11) not null,
 
  74     id int(11) not null auto_increment,
 
  75     name varchar(50) not null,
 
  79 create table memberships (
 
  80     user_id int(11) not null,
 
  81     group_id int(11) not null,
 
  82     primary key  (user_id,group_id)
 
  85 create table membership_statuses (
 
  86     id int(11) not null auto_increment,
 
  87     user_id int(11) not null,
 
  88     group_id int(11) not null,
 
  89     status varchar(50) not null,
 
  93 create table departments (
 
  94     department_id int(11) not null,
 
  95     location_id int(11) not null,
 
  96     primary key (department_id, location_id)
 
  99 create table employees (
 
 100     id int(11) not null auto_increment,
 
 101     department_id int(11) default null,
 
 102     location_id int(11) default null,
 
 106 create table comments (
 
 107     id int(11) not null auto_increment,
 
 108     person_id varchar(100) default null,
 
 109     person_type varchar(100) default null,
 
 110     hack_id varchar(100) default null,
 
 115     name varchar(50) not null,
 
 119 create table kitchen_sinks (
 
 120     id_1 int(11) not null,
 
 121     id_2 int(11) not null,
 
 123     a_string varchar(100),
 
 124     primary key (id_1, id_2)
 
 127 create table restaurants (
 
 128     franchise_id int(11) not null,
 
 129     store_id int(11) not null,
 
 131     primary key (franchise_id, store_id)
 
 134 create table restaurants_suburbs (
 
 135     franchise_id int(11) not null,
 
 136     store_id int(11) not null,
 
 137     city_id int(11) not null,
 
 138     suburb_id int(11) not null
 
 142     id int(11) not null auto_increment,
 
 147     dorm_id int(11) not null,
 
 148     room_id int(11) not null,
 
 149     primary key (dorm_id, room_id)
 
 152 create table room_attributes (
 
 153     id int(11) not null auto_increment,
 
 158 create table room_attribute_assignments (
 
 159     dorm_id int(11) not null,
 
 160     room_id int(11) not null,
 
 161     room_attribute_id int(11) not null
 
 164 create table students (
 
 165     id int(11) not null auto_increment,
 
 169 create table room_assignments (
 
 170     student_id int(11) not null,
 
 171     dorm_id int(11) not null,
 
 172     room_id int(11) not null