1 / 10

Databases – Attributes & Entities Entities A database contains one or more related tables.

Databases – Attributes & Entities Entities A database contains one or more related tables. Each table holds all of the information about an object, person or thing. Some examples of database tables might be: - a customer table - an appointments table - an exam sessions table

seven
Download Presentation

Databases – Attributes & Entities Entities A database contains one or more related tables.

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Databases – Attributes & Entities Entities A database contains one or more related tables. Each table holds all of the information about an object, person or thing. Some examples of database tables might be: - a customer table - an appointments table - an exam sessions table - a teachers' names table - a concert venue table

  2. Databases – Attributes & Entities

  3. Databases – Attributes & Entities Attributes Remember that an entity is a person, place, thing or concept about which data can be collected. Each entity is made up of a number of 'attributes' which represent that entity. Let us explain this a little bit more clearly by using a couple of examples.

  4. Databases – Attributes & Entities Database relationships

  5. Databases – Attributes & Entities Entity Relationship Diagrams These relationships can be shown in the form of a diagram. This diagram is known as an 'entity relationship diagram', E-R diagram or ERD The different types of relationships you can have between entities are: - one-to-one - one-to-many - many-to-many We will look at each of these relationships in turn over the next few slides

  6. Databases – Attributes & Entities One-to-one relationships For the purposes of ERD, we ignore history or what might happen in the future and we concentrate only with the now. Example of one-to-one relationship Think about a husband and wife. A husband can only have one wife. A wife can only have one husband. This would be known as a 'one-to-one relationship. This relationship can be portrayed diagramatically as:

  7. Databases – Attributes & Entities One-to-many (or many-to-one) relationships Example of a one-to-many relationship Think about a mother and her children. A mother can have many children. A child can have only one mother, this would be known as a 'one-to-many relationship. This relationship can be portrayed diagramatically as:

  8. Databases – Attributes & Entities Many-to-many relationships Example of a many-to-many relationship Think about videos in a video hire shop and the shop's customers. A video can be hired by many customers. Customers can hire many videos, this would be known as a 'many-to-many relationship. This relationship can be portrayed diagramatically as:

  9. Databases – Attributes & Entities 9. Changing a many-to-many into a one-to-many relationship A many-to-many relationship is not a good idea when designing database relationships as this breaks the normalisation rules. To overcome this, an extra entity is usually added to the database design which then allows the relationship to become a many-to-one or a one-to-many relationship.

  10. Databases – Attributes & Entities 10. Designing relationships When designing or solving relationships for an E-R diagram, it is helpful to remember the following information: The 'Many' side is usually the foreign key The 'One' side is usually the primary key Before you design or set up a database, you should work out: - the entities - the attributes - the entity relationships This process is called 'data modelling'

More Related