Presentation is loading. Please wait.

Presentation is loading. Please wait.

Rebecca McCready Faculty of Medical Sciences Newcastle University Lecture 1 – Introduction to Databases.

Similar presentations


Presentation on theme: "Rebecca McCready Faculty of Medical Sciences Newcastle University Lecture 1 – Introduction to Databases."— Presentation transcript:

1 http://fms-itskills.ncl.ac.uk Rebecca McCready Faculty of Medical Sciences Newcastle University Lecture 1 – Introduction to Databases

2 http://fms-itskills.ncl.ac.uk Introduction to Databases What is a database? Types of databases. Differences between them. What is normalisation? What are primary and foreign keys?

3 http://fms-itskills.ncl.ac.uk What is a database? “Organised collection of data” Wikipedia (www.wikipedia.org) Using a database you can: Access data in an organised fashion. Filter data for analysis. Record and change data.

4 http://fms-itskills.ncl.ac.uk Types of databases (1) Flat file: Each line is a single entry. Each column is necessary, each row is unique. Simple structure. Should be non-repetitive data. eg. text file, spreadsheet, table of data.

5 http://fms-itskills.ncl.ac.uk Working example: a good flat file Date of BirthAge(years)% Fat 05/07/1969239.5 08/09/19326134.5 09/11/1965277.8 19/03/19533931.4 03/01/19662717.8 10/04/19345833 24/08/19365632.5 12/05/19722131.1 29/12/19395334.7 18/10/19385429.1 31/03/19355730.3 20/02/19702327.9 27/02/19355833.8 06/02/19405342 Questionnaire results. Experiment results. Data that cannot be merged or split.

6 http://fms-itskills.ncl.ac.uk Flat files – the pro’s Good for non-repetitive data. Good for data in a simple structure. Good for describing single instances. Should be easy to analyse. Simple to create and maintain.

7 http://fms-itskills.ncl.ac.uk Flat files – the con’s Difficult to store complex or repetitive data. Difficult to analyse complex data stored in single lines. Can be time-consuming to maintain if data is complex.

8 http://fms-itskills.ncl.ac.uk Working example: a bad flat file Patient ID Date of BirthGender Patient AgeOperation Operation DateHospitalConsultant 104-Feb-69Female30 Nephrectomy - (any)25/02/1999 Southmead Hospital, BristolVadanan 220-Jun-80Female19 Cadaver donor nephrectomy14/01/1999 Southmead Hospital, BristolHolland 305-May-76Male23 Upper polar partial nephrectomy06/08/1999 Southmead Hospital, BristolRoysam 504-Dec-53Female46 Nephro- ureterectomy - (any)25/02/1999 Southmead Hospital, BristolSanderson 1401-Feb-83Female15 Nephrectomy - (any)18/10/1998 Frimley Park Hospital, CamberleyJones 1607-Jun-85Male13 Enucleation of renal tumour10/09/1998 Southmead Hospital, BristolWhiteaway 1607-Jun-85Male13 Upper polar partial nephrectomy17/10/1998 Frimley Park Hospital, CamberleyJones O Blue: Multiple fields of repeated data. O Green and Grey: Closely related data. O If this is true then…

9 http://fms-itskills.ncl.ac.uk Types of databases (2) Relational databases: Made of several tables. Each table should relate to another. Complex data is broken down into simple tables. Each entry in each table has a unique identifier. Based on Set Theory in Maths where members have shared characteristics. eg. Database.

10 http://fms-itskills.ncl.ac.uk Working example: a good database Performed on Host BelongsBelongs Responsible for ID

11 http://fms-itskills.ncl.ac.uk What is normalisation? Process of applying design rules to a database. 3 normal forms are necessary (NF), although 5 normal forms exist. First normal form: No duplicated rows, each cell has a single value and each table has a designated primary key. Second normal form: PLUS each table is dependent entirely on the primary key. Third normal form: PLUS each column must depend directly on the primary key.

12 http://fms-itskills.ncl.ac.uk What are Primary and Foreign Keys? A Primary Key uniquely identifies each record in a database table. E.g. Patient hospital number, NI numbers, Student IDs etc. A Foreign Key is a linked field to a primary key field in another table to indicate that the two records have matching values.

13 http://fms-itskills.ncl.ac.uk Working example: requires complex front end Record ID Operation Date Patient ID Patient Age Operation ID Hospital ID Consultant ID 110/09/199816131411720 217/10/199822638919 312/01/19991454101175 A complex front end is required to make sense of this data and allow easy input of data: Who is patient number ‘16’ or consultant number ‘5’? What operation is number ‘3’?

14 http://fms-itskills.ncl.ac.uk Relational databases – the pro’s Excellent for storing complex data. Excellent if data becomes difficult to manage or analyse in flat file form. Excellent if data becomes repetitive. Excellent if you have multiple questions to ask in your study.

15 http://fms-itskills.ncl.ac.uk Relational databases – the con’s Difficult to create. Often difficult to separate data properly: ‘normalisation’. Require complex ‘front ends’ to manage them easily and make sense of data. Requires a greater level of knowledge and skill to use.

16 http://fms-itskills.ncl.ac.uk So how do you decide? Is your data repetitive? Do you have complex queries to run? Are you unsure of what queries you might want to ask of your data? Do you have complex groupings and relationships between data fields? Are you able to put the time and effort in to create one? Do you have the confidence to do so? If YES to any, use a Relational DB.

17 http://fms-itskills.ncl.ac.uk To conclude Flat file: Single lines of data. Unrelated to each other. Relational database: Many tables of single lines. Relationships between tables. Shared characteristics. Choose most suitable for your data and you.


Download ppt "Rebecca McCready Faculty of Medical Sciences Newcastle University Lecture 1 – Introduction to Databases."

Similar presentations


Ads by Google