Presentation is loading. Please wait.

Presentation is loading. Please wait.

Relational Databases Farrokh Alemi, PhD Narrated by Farhat Fazelyar

Similar presentations


Presentation on theme: "Relational Databases Farrokh Alemi, PhD Narrated by Farhat Fazelyar"— Presentation transcript:

1 Relational Databases Farrokh Alemi, PhD Narrated by Farhat Fazelyar
In this section we will discuss the importance or Relational Databases and why we use them. The PowerPoints provided are organized by Dr. Farrokh Alemi and narrated by Farhat Fazelyar

2 Relational Databases Explained
This video describes how relational databases work.

3 More than One Table of Data
Relational Databases Explained In a relational databases data are kept in multiple tables, which are related to each other using common fields. More than One Table of Data

4 Relational Databases Explained
We demonstrate the concept through two tables of data, one about doctors, the other about patients. Then a visit table may list patients visits to one of the doctors. Example

5 Patients Imagine a table of data that holds patient information

6 Patients Doctors Imagine another table that hold Information about doctors and clinicians. This is like saying that we will have a list of patients and a list of Doctors.

7 Events that involve doctors and patients
We want to use these lists to describe events that involve both doctors and patients.

8 Patients Patient ID For the Patients we might have information such as a patient ID

9 Patients Patient ID Patient Name Patient Name

10 Patients Patient Name OS Patient ID
and what operating system they are using. The table may contain other information as well but for simplicity lets stay with these three fields of information about the patients.

11 Doctors Doctor ID For the Doctors we can have a Doctors ID

12 Doctors Doctor ID Class Name Doctors Name

13 Doctors Doctor ID Class Name Doctor’s System
And doctor’s operating system. There may be other information as well but lets keep this simple and assume that we have just these three pieces of information.

14 Patients Table Patient ID Patient Name MAC OS X Patient1001 John Snow
If we look at the patient’s table, we might have a table that looks something like this. There are three fields, patient ID the patient name and the operating system. The first row of data shows patient 1001 who is John Snow and who uses MAC operating system X.

15 Patients Table Patient ID Patient Name MAC OS X Patient1001 John Snow
Carol Alan IRIX Patient 1002 is Carol Alan who uses IRIX as an operating system.

16 Patients Table Patient ID Patient Name MAC OS X Patient1001 John Snow
Carol Alan IRIX Patient1003 Blake Colin Windows The table contains information on other patients. Here we are showing patients 1003 and 1004. Patient1004 Owen Paul Unix

17 Patients Table Unique Patient ID Patient Name MAC OS X Patient1001
Jon snow MAC OS X Patient1002 Carol Alan IRIX Patient1003 Blake Colin Windows IF were trying to refer to one of these patients record, two patients may have the same name or use the same operating system. The only field that shows a unique patient is the patient ID field. There are no duplicates allowed in the patient ID field. Patient1004 Owen Paul Unix

18 Patients Table Primary Key Patient ID Patient Name MAC OS X
Jon snow MAC OS X Patient1002 Carol Alan IRIX Patient1003 Blake Colin Windows A field that is uniquely identifies all entries in the table is also called primary key. Every table provides information about records identified by its primary key. Patient1004 Owen Paul Unix

19 Doctors Table Doctors ID Doctors Name MAC OS X DR2004 David Gordan
Windows Let us also imagine some data in the table about the Doctors. This table includes the doctor’s ID, name and operating system. In the first row of the data we have doctor DR His name is David Gordan and he is using windows operating system.

20 Doctors Table Doctors ID Doctors Name MAC OS X DR2004 David Gordan
Windows DR2006 Nicola Pippa IRIX DR2008 Rachel Robert Windows In the second row we have DR His name is Nicola Pippa and he is using IRIX operating system. Each row describes a different doctor. The primary key is the field “Doctors ID”. All of the information in this table is about unique cases reported in each row. DR2010 Julian Liam MAC OS X

21 Visit Table Patient ID Doctors ID Patient1001 DR2004
To describe a patients visit to a doctor, we set up a third table called the visit table. We need to show that a particular patient visited a particular doctor. We can do this by just using the primary keys of each of the two tables. Once we know the IDs, we can look up the remaining information with no problem in each of the relevant tables. In the first row of this table we are showing that patient 1001 was seen by Doctor 2004.

22 Visit Table Patient ID Patient1001 Patient1002 Patient1003 Patient1004
Doctors ID DR2004 DR2006 DR2008 In subsequent rows we show that who various patients are seeing. Here, for example, we show that patient 1004 is also seen by doctor 2004.

23 Visit Table Massive Patient ID Patient1001 Patient1002 Patient1003
Doctors ID DR2004 DR2006 DR2008 You can go ahead and add as many visits as you want to the visit table. It often grows to thousands or millions of visits. Massive

24 Massive but Compact & Efficient
Visit Table Patient ID Patient1001 Patient1002 Patient1003 Patient1004 Doctors ID DR2004 DR2006 DR2008 Massive but Compact & Efficient Yet none of the information on patient or doctor tables are duplicated in the visit table. So the table is compact and efficient. This makes a world of difference in data analysis.

25 Patient & Doctor Tables Remain Small
Visit Table Patient ID Patient1001 Patient1002 Patient1003 Patient1004 Doctors ID DR2004 DR2006 DR2008 Patient & Doctor Tables Remain Small Patient and doctor tables remain small even though the visit table may be massive.

26 Massive but Compact & Efficient Visit Table
Patient ID Patient1001 Patient1002 Patient1003 Patient1004 Doctors ID DR2004 DR2006 DR2008 Massive but Compact & Efficient Visit Table None of the information on patient or doctor tables are duplicated in the visit table. So the visit table is compact and efficient.

27 Only Information that Changes
Visit Table Patient ID Patient1001 Patient1002 Patient1003 Patient1004 Doctors ID DR2004 DR2006 DR2008 Only Information that Changes The visit table has the minimum amount of information. Only information that changes from visit to visit is recorded in the visit table. The rest of the information that does not change from visit to visit are kept in auxiliary tables. This makes a world of difference in data storage and analysis.

28 massive but Compact databases are organized using Relational Databases: Multiple Tables & the relationships among these Tables Massive but compact databases are organized using multiple tables & relationships among these tables


Download ppt "Relational Databases Farrokh Alemi, PhD Narrated by Farhat Fazelyar"

Similar presentations


Ads by Google