Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: data definition
"Gavin Sim" <schowe_at_singnet.com.sg> writes:
> Hi Tim,
> thanks for your comment. This is only part of my modelling being reviewed.
> Actually i am trying to practise on the data definition on oracle thus my
> data model isn't that important at this point of time. But i did realised
> there is mistake and made the necessary amendments.
>
> Given the sample below the info_no is the primary key of the hotel.
> hotel_no and room_no are the primary keys
>
> information(info_no, hotel_no, room_no, datetime)
> hotel(hotel_no, hotel_name, Hotel_district)
> room(room_no, room_describe)
>
>
> Given the information above, how can I write in data definition in a way
> that i can ensure (no hotel or room can have 2 different information at the
> same time. This mean a user can only register in a hotel or register a room
> at the same time and not register 2 rooms or 2 hotels at the same time.
>
> can I use constraint check( unique(hotel,room)...... on the information
> table?
> I know this is wrong too sign.
Well....
I think your data model still lacks the necessary information to achieve what you want. If you make hotel_no and room_no unique, then you will only ever be able to have one record for each combination.
Tim
-- Tim Cross The e-mail address on this message is FALSE (obviously!). My real e-mail is to a company in Australia called rapttech and my login is tcross - if you really need to send mail, you should be able to work it out!Received on Sun Dec 15 2002 - 16:00:02 CST