Your SlideShare is downloading. ×
0
Relational Databases 2
Relational Databases 2
Relational Databases 2
Relational Databases 2
Relational Databases 2
Relational Databases 2
Relational Databases 2
Relational Databases 2
Relational Databases 2
Relational Databases 2
Relational Databases 2
Relational Databases 2
Relational Databases 2
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Relational Databases 2

543

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
543
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
24
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  1. Introduction to Relational Databases 2
  2. Data Relationships <ul><li>A relationship is a logical link between entities based on how they interact. </li></ul><ul><li>An entity is something about which you want to store data. e.g. customers, invoices, items </li></ul>
  3. Entity Relationships <ul><li>These are based on entity sets and the relationships between the sets of entities. </li></ul><ul><li>An Entity Relationship diagram is a graphical model of the database. </li></ul><ul><li>Entities whose information is dependent on each other are said to have a relationship. </li></ul><ul><li>Relationships can be one-to-one, one-to-many or many-to-many </li></ul>
  4. Relationships One-To-One Each record in one table can have only one matching record in another, and each record in the other can have only one matching record in the first. Not a common relationship. One-To-Many A record in one table can have many matching records in another, but a record in the other has only one matching record in first The most common form of relationship. Many-to-Many A record in one table can have many matching records in another, and a record in the other can have many matching records in the first
  5. ER Diagrams <ul><li>Entities are drawn in boxes </li></ul><ul><li>Relationships are shown as a line between boxes. </li></ul><ul><li>Arrows at the end of the lines indicate the type of relationship (1-to-1, etc) </li></ul>
  6. ER Diagrams This is a one-to-many relationship - one subject can have many students This is a one-to-one relationship - one student can only have one student ID STUDENT SUBJECT STUDENT STUDENT ID
  7. Creating ER Diagrams <ul><li>1. Identify the entities </li></ul><ul><li>2. Define the relationships </li></ul><ul><li>3. Define the type of relationship </li></ul><ul><li>4. Create the table structure for a database </li></ul>
  8. Creating ER Diagrams Identify attributes Identify entities Year Student ID Surname Student SubjectID Name Subject
  9. <ul><li>Define Relationships </li></ul><ul><ul><li>A relationship is what links entities together. </li></ul></ul>Creating ER Diagrams Student Studies Subject
  10. Stage 3 <ul><li>Define type of relationship </li></ul><ul><ul><li>One to One </li></ul></ul><ul><ul><li>One to Many </li></ul></ul><ul><ul><li>Many to Many </li></ul></ul> Student Studies Subject 1 M
  11. Stage 4 <ul><li>Define the table structure for the database </li></ul>Student Studies Subject 1 M 1 M 3 IT 3 12 Smith 3 1 English 2 11 Black 2 1 Maths 1 9 James 1 StudID Subject SubjectID Year Surname StudID STUDENT SUBJECT
  12. Normalisation <ul><li>A technique that is used to arrange data so that data redundancy is minimised. </li></ul><ul><li>There are five ‘normal forms’ but only the first three are considered here. </li></ul>
  13. Un-normalised Data Repeating groups and Null values A company manufactures and supplies a variety of products to retail suppliers .

×