Buildings - non-sono-bello-ma-patcho/BD_LAB GitHub Wiki

For each building, the database will keep track of name (univocal), address, phone number, email address, coordinates. This is how we design the building entity in the ER scheme:

To keep the schema clean we omitted all the attributes that are not primary or external, as you can see in fact the only attribute shown is name. The photo attribute had been translated as an external reference.

This is how we translated the entity:

create table Buildings (
  name varchar(64) primary key,
  address varchar(128),
  phoneNumber varchar(16),
  email varchar(64),
  photo bigserial references Photos on delete cascade on update cascade,
  longitude numeric(7, 4),
  latitude numeric(7, 4)
);

Arguments...