Download presentation
Presentation is loading. Please wait.
Published byRosamund Small Modified over 9 years ago
1
Relational Database Need to Knows
2
What is a database? Data - is just a pile of numbers or stats. A business "organises" the data to be meaningful and help make decisions. Database (DB) – brings “order” to the data using relationships.
3
What’s a Flat File database? It is a DB with 1 table only An excel spreadsheet is an example of a flat file database. It stores information in columns and rows. Column – a field or entity e.g. customer name or date of birth; Row – a record e.g. a customer Table – a collection of columns and rows e.g. customers
4
Column vs Row
5
Flat File Example Typical spreadsheet that shows Sales Reps, their hourly rates and email details. Note – Column e.g. Name; Row e.g. Ayla’s name, pay rate and email address.
6
Flat File cont… What if you wanted to track the Sales Reps projects they were working on, and hours? We could add two more columns e.g. Job Description and Job Hours. If Carla does 3 different projects, we’d need to enter her 3 times in the spreadsheet.
7
Problems? Redundancy – the same data duplicated in multiple places e.g. Carla’s email address. What if this flat file had 1000 records, and she changed her email address? Inefficient way to keep track of data using a single table
8
Better solution? Use two tables to track the same information – Sales Rep table that stores all information about the Sales Reps. Then create a second Job Table to track all the jobs the sales reps do. Decreases redundancy because if her email or pay rate change, just change it in the one place i.e. customer table.
9
Problem? Anomalies – what happens if I accidentally delete Carla from the Sales rep table? In a flat file DB like this spreadsheet, there is no “integrity” checks to make sure “orphan” entries don’t happen. To avoid Anomalies, Redundancy and to improve data efficiency, use a Relational Database.
10
From Flat File to Relational: Entity – A table should be a collection of data about a single “entity” or “theme” e.g. customer; employee; orders; Field – the column headings that describe the entity e.g. customer firstname; customer lastname; DOB; Email; Phone; Data Type – specifies what type of data can be stored in a field e.g. Number or Text.
11
Identifying Entities… Look at this spreadsheet, what “entities” or tables could you pull from this data? Clue – look at fields/columns that duplicate information.
12
Possible Entities / Tables Genre RatingsStudioMovies
13
What Fields and Types? Now try and write what fields and their types you’d have under each table. When you have had these ticked off by Miss, look at the information in the assessment task on the wiki, and complete Database Design Task 1a) You can either use the sample data in the task, OR your own club/information.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.