Home > Software engineering >  PostgreSQL Sample Database Crow Foot Notation
PostgreSQL Sample Database Crow Foot Notation

Time:01-23

I have a question regarding the ERD below DVD Database ERD

I am trying to understand whether I interpret crow foot notation correctly:

  • a customer can have zero or many payments
  • a customer can have zero or one rentals.

Payments part sounds good, but I did not understand rentals.

From the data, it looks like a customer can have more than one rental.

SELECT * FROM rental where customer_id = 459

this yields 38 rows.

Similarly from ERD I understand that staff can participate in zero or many rentals. My questions, then why don't customer have zero or many relation with rental.

Here is a link to DB documentation

Thank you!

CodePudding user response:

according to erd the table should have constraing unique on rental; if it is yielding 38 rows it means constraint is not applied in the databased but is managed by the code which runs local on a computer and can have conflictions that is what constraints are for.

  •  Tags:  
  • Related