drderkummer / Software-Engineering-Project

1 stars 0 forks source link

Database-Setup #6

Closed drderkummer closed 11 years ago

drderkummer commented 11 years ago

Hej, just was thinking about the database u set up, shouldnt it look diffrent? When i stick to rules i learned in databses we should have:

entities:

Buildings (_name) Entries (_xCoord, _yCoord) (maybe address as well?) Rooms (_name, xCoord, yCoord) Types (_name)

and then there would be tables for the following relationships as well:

EntrIsInBuilding(_name, _xCoord, _yCoord) Building.name Entries.xCoord Entries.yCoord

RoomIsInBuilding(_name, _name) Rooms.name Buildings.name

hasType(_name, _name) Rooms.name Types.name

This are more tables but will end up in easier searchfunctions and a cleaner code, or am i thinking a wrong way?

freein commented 11 years ago

You decompose to much. I took the database course last period. My database is already in BCNF. I can show you on friday if you want.

One rule you don't follow is that you don't have to create a separate tables for relations if it is a many to exacty one relation. The key in my Buildings-table determines all other atributes.

But your database is also in BCNF but it leads to more data and more joins. Den 24 apr 2013 19:12 skrev "Rene Ni" notifications@github.com:

Hej, just was thinking about the database u set up, shouldnt it look diffrent? When i stick to rules i learned in databses we should have:

entities:

Buildings (_name) Entries (_xCoord, _yCoord) (maybe address as well?) Rooms (_name, xCoord, yCoord) Types (_name)

and then there would be tables for the following relationships as well:

EntrIsInBuilding(_name, _xCoord, _yCoord) Building.name Entries.xCoord Entries.yCoord

RoomIsInBuilding(_name, _name) Rooms.name Buildings.name

hasType(_name, _name) Rooms.name Types.name

This are more tables but will end up in easier searchfunctions and a cleaner code, or am i thinking a wrong way?

— Reply to this email directly or view it on GitHubhttps://github.com/drderkummer/Software-Engineering-Project/issues/6 .

drderkummer commented 11 years ago

A yeah, youre right! Forgot about that many to one thing and it totally makes sence, just should have thought about it for some more minutes!

other thing: should we make the database setup in another file, just to have it clearer or should i type the insert into the DAO file?

freein commented 11 years ago

You shouldn't have any data in the DAO file.

By the way your relations helped me spot a bug in the database. The coordinates in rooms are also key. I should mark them unique to. Den 24 apr 2013 21:52 skrev "Rene Ni" notifications@github.com:

A yeah, youre right! Forgot about that many to one thing and it totally makes sence, just should have thought about it for some more minutes!

other thing: should we make the database setup in another file, just to have it clearer or should i type the insert into the DAO file?

— Reply to this email directly or view it on GitHubhttps://github.com/drderkummer/Software-Engineering-Project/issues/6#issuecomment-16960412 .

freein commented 11 years ago

Or no. There can be different rooms with same coordinates but on different floors. Thanks anyway. Den 24 apr 2013 21:58 skrev "Fredrik Einarsson" <freein@student.chalmers.se

:

You shouldn't have any data in the DAO file.

By the way your relations helped me spot a bug in the database. The coordinates in rooms are also key. I should mark them unique to. Den 24 apr 2013 21:52 skrev "Rene Ni" notifications@github.com:

A yeah, youre right! Forgot about that many to one thing and it totally makes sence, just should have thought about it for some more minutes!

other thing: should we make the database setup in another file, just to have it clearer or should i type the insert into the DAO file?

— Reply to this email directly or view it on GitHubhttps://github.com/drderkummer/Software-Engineering-Project/issues/6#issuecomment-16960412 .

drderkummer commented 11 years ago

Jepps, we (can) have diffrent rooms with same coordinates but diffrent floors. ;) But name as a key is unique and enough, isnt it?

freein commented 11 years ago

yes it is. But if you have a second key you should mark it unique().

Med Vänliga Hälsningar Fredrik Einarsson

0707295097 Student Datateknik CETAC 2013

2013/4/24 Rene Ni notifications@github.com

Jepps, we (can) have diffrent rooms with same coordinates but diffrent floors. ;) But name as a key is unique and enough, isnt it?

— Reply to this email directly or view it on GitHubhttps://github.com/drderkummer/Software-Engineering-Project/issues/6#issuecomment-16961528 .

drderkummer commented 11 years ago

you mean UNIQUE (ycoord, ycoord, floor) ?

freein commented 11 years ago

Yes :) Den 24 apr 2013 22:27 skrev "Rene Ni" notifications@github.com:

you mean UNIQUE (ycoord, ycoord, floor) ?

— Reply to this email directly or view it on GitHubhttps://github.com/drderkummer/Software-Engineering-Project/issues/6#issuecomment-16962528 .

drderkummer commented 11 years ago

jepp for sure. alright. i will create a new er diagram for our documentation then.