![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Application is about to help, let's say, ROOMMATES to keep track of payed/not payed BILLS for a house they live in. I thought i could make 3 tables: BILLS( #bill(PK),amount,date,payedBy ) ROOMMATES( #mate(PK),name ) RoomMatePayed( #bill(FK),#mate(FK)) I want to SELECT all the bills in the BILLS table and a name of roommate fthat payed that bill. Is it good idea to put NULL in payedBy atribut for bills that are not payed? |
#3
| |||
| |||
|
|
I'm trying to make a good model for a following problem. Application is about to help, let's say, ROOMMATES to keep track of payed/not payed BILLS for a house they live in. I thought i could make 3 tables: BILLS( #bill(PK),amount,date,payedBy ) ROOMMATES( #mate(PK),name ) RoomMatePayed( #bill(FK),#mate(FK)) I want to SELECT all the bills in the BILLS table and a name of roommate fthat payed that bill. Is it good idea to put NULL in payedBy atribut for bills that are not payed? Hope It's not confusing... Thanks No, that would not be a good idea. If the roomate has not |
#4
| |||
| |||
|
|
Thanks No, that would not be a good idea. If the roomate has not paid anything, don't add a row. See the beauty? |
#5
| |||
| |||
|
|
luigi7up wrote: Application is about to help, let's say, ROOMMATES to keep track of payed/not payed BILLS for a house they live in. I thought i could make 3 tables: BILLS( #bill(PK),amount,date,payedBy ) ROOMMATES( #mate(PK),name ) RoomMatePayed( #bill(FK),#mate(FK)) I want to SELECT all the bills in the BILLS table and a name of roommate fthat payed that bill. Is it good idea to put NULL in payedBy atribut for bills that are not payed? Yes. Sounds okay to me. But what do you intend to do with the RoomMatePayed relation? Regards, Michael. |
#6
| |||
| |||
|
|
Sorry , I just noticed that ROOMMATES and BILLS is not M:M relationship so roommatePayed is not necessary as Associative entity. My solution is going to look as follows: BILLS(#bill (PK) ,amount,date,payedBy (FK) ) // I'm about to put payedBy = NULL if the bill hasn't been payed yet. This is OK? ROOMMATES(#roommate(PK),name) |
![]() |
| Thread Tools | |
| Display Modes | |
| |