I am creating a hotel master where i've these tables :
tbl_hotel_type : id,type_name,type_code and more
tbl_hotel : id,name,code and more
tbl_hotel_info : id,hotel_id,hotel_type_id and more
tbl_room_categories : id,hotel_type,room_catname,room_catcode and more
Now i want to relate which hotel has which room categories ie
1.Should i add another column in "tbl_hotel_info" as "room_categories" that will contain ids of all room categories in single column in particular row of "tbl_hotel_info" for a particulat hotel info.
Or both approaches are wrong and, I've to do something else please suggest me a better way to achieve this . Thanx.
This is too long for a comment.
Something seems wrong with your design. I am not expecting a hotel_type
to be in room categories. Where is the HotelTypes
? (I don't see a reason to prepend table names with tbl_
.)
In practice, it sounds like you want a junction table. I would envision tables such as:
RoomCategories: RoomCategoryId, CategoryName, CategoryCode, . . .
HotelRoomCategories: HotelId, RoomCategoryId
Hotels: HotelId, HotelTypeId
HotelTypes: HotelTypeId, TypeName, TypeCode
I also don't think you need a separate "hotel info" table. That information would seem to belong in the Hotels
table directly.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.