Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2014
    Posts
    4

    How to represent this relationship on this ERD

    Hi

    Looking to implement this ER Diagram but not entirely sure how I would implement the relationship between the Parking and the AuthorisedCars entity.

    Basically the Parking entity will record the parking event in that it will record the reg number, the time and date of the event as well as if the car left or entered the car park. The Reg number along with the Time and date are down as the primary key.

    In the AuthorisedCar entity has the Reg number along with the make, model and colour of the car and this will be used to record all the authorised cars that are allowed to park.

    The relationship shows that a Parking event may or may not be for an Authorised Car, and that an Authorised Car may or may not have Many Car Parking Events.

    How would I represent this relationship in a Relational Model for the database implementation. I thought of a foreign key for Reg Number in the Parking entity as a car that is NOT on the authorised list may enter / exit the car park so a foreign key is not acceptable as there will not be a matching entry in the AuthorisedCar entity.

    How would you implement this?

    Thanks
    Attached Thumbnails Attached Thumbnails 1.jpg  

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    You need to make the registration number in the parking table optional (NULL-able). That implies that it can't be part of the PK (Primary Key) for the Parking table.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Apr 2014
    Posts
    4
    Quote Originally Posted by Pat Phelan View Post
    You need to make the registration number in the parking table optional (NULL-able). That implies that it can't be part of the PK (Primary Key) for the Parking table.

    -PatP
    Thanks but the registration number will always be populated, whether or not it existed in the authorised cars table so it wouldn't be null?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •