• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I defined field "Hotel Name " and field "City" as union primary key,is that ok?

 
Lee patrick
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey every one! I defined field "Hotel Name " and field "City" as union primary key,is that ok?(URLYBird )
 
Frans Janssen
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Lee,

I am not completely familiar with the URLybird assignment, but from what I picked up on this forum the database file contains a collection of bookable hotel rooms? In the case the primary key you have chosen does not seem appropriate to me, because it would be impossible for your database to contain more than one room per hotel.

Frans.
 
Lee patrick
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The "Hotel Name" means the name of the hotel,not the room's name.One city can not have two hotel with the same name,I think.
 
Frans Janssen
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I agree, but your database could contain two rooms from the same hotel in the same city, e.g.

"Panorama hotel", "Peak City", "112" and
"Panorama hotel", "Peak City", "089".

If you choose name + city as primary key, these records would have the same key and be allowed to coexist in the database. So I think your key should be name + city + room.

Frans.
 
Muthaiah Ramanathan
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With What I have done - I don't have any primary keys( in the given fields). The record number is assumed to be the primary key - as no other record can exist in this record. Make it simple.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic