SlideShare a Scribd company logo
Basic Database Concepts
By Odaly Fernandez
What is a database
 A database is any collection of information
(data).
 This collection represents part of the real
world.
 The data is organized in some manner so
that the information contained within the
database can be easily retrieved.
Examples of database
 Phone books
 Library
 School
 Search engines
Relational Database Modelling
 Uses a collection of tables to represent both
data and the relationship among those data
 Each table has multiple columns
 Each column has a unique name
Relational database – Basic concepts
EMPLOYEE table (collection of related records)
EmployeeID Name Hire Date
1122 Bill White 1/1/2001
2387 Ron Smith 27/9/2001
4456 Greg King 24/8/1999
CUSTOMER table
CustomerID Name Address Phone
100 Lyons 123 A Street 916-444-55
101 Dennys 435 Elm Street 916-478-23
102 IHOP 654 17th
Av. 916-458-77
ORDERS table
Order Number CustomerID EmployeeID Cost
101 100 1122 23.78 €
145 100 2387 100.25 €
152 102 2387 54.89 €
Record
(collection of
related fields)
Field (a single piece of
information)
Database Management System (DBMS)
 Software that allows users to create,
maintain, and query your data in the related
tables
 Examples: MS Access, Oracle, FoxPro,
MySql
Primary and foreign keys
 Primary Key, a value that is unique to each
record
 Foreign Key, a primary key of one table
included in another table. Link tables to each
other.
 Find the PK and FK on the last relational
database example.
Referential Integrity
 Referential integrity is a
database concept that
ensures that relationships
between tables remain
consistent.
 What happens if:
 Marketing’s DID is changed
to 16 in DEPARTMENT?
 The entry for Accounts is
deleted from
DEPARTMENT?
DID DName
13 Marketing
14 Accounts
15 Personnel
EID EName DID
1515 John Smith 13
1600 Mary Brown 14
1717 Mark Jones 13
1800 Jane Smith 13
DEPARTMENT
EMPLOYEE
Types of relationships
One to one
An entity in A is associated with at most one
entity in B, and an entity in B is associated
with at most one entity in A
a1
a2
a3
a4
b1
b2
b3
b4
A B
One to one examples
 Husband and wife
 Person and passport
 Teachers and computers
Types of relationships
One to many
An entity in A is associated with any number
(zero or more) of entities in B. An entity in B,
however, can be associated with at most one
entity in A
a1
a2
a3
a4
b1
b2
b3
b4
b5
A B
One to many examples
 Mother - children
 One department contains many employees,
but one employee works in one department
only.
 Customers – orders
 Car - owner
Types of relationships
Many to many
An entity in A is associated with any number
(zero or more) of entities in B, and an entity in
B is associated with any number of entities in
A
a1
a2
a3
a4
b1
b2
b3
b4
b5
A B
Many to many examples
 Each student takes several subjects, and each subject is
taken by several students.
 Authors – Books
 A project can have many employees working on it. And, an
employee can work on many projects.
 In a library, a book can be borrowed by many borrowers. A
borrower can borrow many books.
Types of relationships
 In a database we store information about
books, the authors, the category of the
books, and the publishers.
 A book can have more than one author.
 A book can be of more than one category.
 A publisher publishes many books. A book is
published only for one publisher.
 What types of relationships do we have here?
Designing a database structure
 As you are gathering information in the
requirements phase, you should be thinking
about these items:
 Identify all of the fields you are going to need
and ways to organize the related fields into
tables
 Determine or build a primary key for each
table if needed
Designing a database structure
 Compare the two tables below. You will see situations that you
want to avoid:
1) Avoid data redundancy.
2) If you can avoid data redundancy, you can avoid data
mistakes. Look at the customer name for customer #635 in both
tables. Two different spellings. Which one is correct?
3) Notice that there are two different customers in the Orders
table that have the same customer number (#104). If your billing
system uses the customer number to drive it, who’s going to get
the bill?
4) Notice that some of the customers in the Orders table aren’t
even listed in the Customer table. Will these customers ever get
a bill?
CUSTOMER table
CustID Name Address Phone City State
104 Meadows Restaurant Pond Hill Rd 313-792 Monroe Mi
128 Grand River Restaurant 37 Queue Av. 313-729 Lacota MI
163 Bentham’s Restaurant 1366 36th
St 517-792 Monroe MI
635 Oaks Restaurant 3300 West Russell St 419-336 Maumee OH
741 Prime Cut Steakhouse 2819 East 10th
St 219-336 Mishawalka IN
779 Gateway Lounge 3408 Gateway B1 419-361 Sylvania OH
ORDERS table
OrdID CustID Name Billing Date Invoice Amount
202 104 Meadows Restaurant 15/1/12 1280.50
226 635 Oakes Restaurant 15/1/12 1939.00
231 779 Gateway Lounge 15/1/12 1392.50
309 741 Prime Cut Steakhouse 15/2/12 1928.00
313 104 Stokes Inn 15/2/12 1545.00
377 128 Grand River Restaurant 15/3/12 562.00
359 635 Raks Restaurant 15/3/12 1939.00
373 779 Gateway Lounge 15/3/12 1178.00
Designing a database structure
The South India Motor Company is designing a new database to store
information on its employees, their job details and information about the
branches in which they work. For each employee, it needs to hold
information on the employee's name, their payroll number (which is unique
to them and has two letters followed by four digits, the first letter is always M
or C), the branch that they work at and the job that they perform. For each
employee, the job code and description needs to be stored along with the
rate of pay for that job. For each branch of the company, it needs to record
the branch number, the branch name, the address and a weighting which is
used to calculate salaries. This weighting ensures that employees living in
areas where housing and other costs are high receive more pay than
workers in areas where housing costs are lower. The weighting is a decimal
value between 0 and 2.
Design the structure of the database you would build to hold this data.
Designing a database structure
 Identify tables, fields, and relationships from
the problem description.
 How do I find tables and fields?
 Tables and fields are often represented by
nouns in the description
Designing a database structure
 How do I tell the difference between a
table and a field?
 Field values are atomic, so fields can't have
smaller parts or be groups of things.
 Fields can't participate in relationships.
 Fields have a single value (a string, a
number, etc), whereas tables have complex
values (groups of fields generally).
Designing a database structure
 How do I find potential relationships
between tables?
 Relationships are often verbs or phrases that
link two tables in the problem description.
Designing a database structure
 How do I determine the type of relationship?
 Sometimes this is apparent from the description.
 Sometimes it is less clear, and you need to think
about what situations are possible.
Designing a database structure
So which are our tables?
What data type should you use for each field?
Which fields should be primary key?
What relationships will be needed?
Validation rules
 Range check
 Look-up check
 Format check
 Length check: passwords
 Type check
Data verification
 There are two main methods of verification:
 Double entry - entering the data twice and
comparing the two copies.
 Proofreading data - this method involves
someone checking the data entered against
the original document.

More Related Content

What's hot

Practical guide to SQL basics
Practical guide to SQL basicsPractical guide to SQL basics
Practical guide to SQL basics
Pavani Ganti
 
Relationships within the relational database
Relationships within the relational databaseRelationships within the relational database
Relationships within the relational databaseJanecatalla
 
Creating relationships with tables
Creating relationships with tablesCreating relationships with tables
Creating relationships with tablesJhen Articona
 
Databases By ZAK
Databases By ZAKDatabases By ZAK
Databases By ZAK
Tabsheer Hasan
 
Data base management system (2)
Data base management system (2)Data base management system (2)
Data base management system (2)
MrinalDev1
 
Create table relationships
Create table relationshipsCreate table relationships
Create table relationships
Dastan Kamaran
 
Sql joins final
Sql joins finalSql joins final
Sql joins final
mbadhi
 
Normalization PRESENTATION
Normalization PRESENTATIONNormalization PRESENTATION
Normalization PRESENTATION
bit allahabad
 
Remembering Edgar Frank “Ted” Codd - Founder of Relational Databases
Remembering Edgar Frank “Ted” Codd - Founder of Relational DatabasesRemembering Edgar Frank “Ted” Codd - Founder of Relational Databases
Remembering Edgar Frank “Ted” Codd - Founder of Relational Databases
Bala Nagendra Betha
 
SQL Joins
SQL JoinsSQL Joins
SQL Joins
Paul Harkins
 
SQL Join's
SQL Join'sSQL Join's
SQL JOINS
SQL JOINSSQL JOINS
SQL JOINS
PuNeEt KuMaR
 
Relational database
Relational databaseRelational database
Relational database
SanthiNivas
 
Design your own database
Design your own databaseDesign your own database
Design your own database
Frank Katta
 
Normalisation and anomalies
Normalisation and anomaliesNormalisation and anomalies
Normalization
NormalizationNormalization
Normalizationlingesan
 
Cis336 all i labs week 1 to week 7 devry university
Cis336 all i labs week 1 to week 7 devry universityCis336 all i labs week 1 to week 7 devry university
Cis336 all i labs week 1 to week 7 devry university7Fase1
 

What's hot (18)

Practical guide to SQL basics
Practical guide to SQL basicsPractical guide to SQL basics
Practical guide to SQL basics
 
Database
DatabaseDatabase
Database
 
Relationships within the relational database
Relationships within the relational databaseRelationships within the relational database
Relationships within the relational database
 
Creating relationships with tables
Creating relationships with tablesCreating relationships with tables
Creating relationships with tables
 
Databases By ZAK
Databases By ZAKDatabases By ZAK
Databases By ZAK
 
Data base management system (2)
Data base management system (2)Data base management system (2)
Data base management system (2)
 
Create table relationships
Create table relationshipsCreate table relationships
Create table relationships
 
Sql joins final
Sql joins finalSql joins final
Sql joins final
 
Normalization PRESENTATION
Normalization PRESENTATIONNormalization PRESENTATION
Normalization PRESENTATION
 
Remembering Edgar Frank “Ted” Codd - Founder of Relational Databases
Remembering Edgar Frank “Ted” Codd - Founder of Relational DatabasesRemembering Edgar Frank “Ted” Codd - Founder of Relational Databases
Remembering Edgar Frank “Ted” Codd - Founder of Relational Databases
 
SQL Joins
SQL JoinsSQL Joins
SQL Joins
 
SQL Join's
SQL Join'sSQL Join's
SQL Join's
 
SQL JOINS
SQL JOINSSQL JOINS
SQL JOINS
 
Relational database
Relational databaseRelational database
Relational database
 
Design your own database
Design your own databaseDesign your own database
Design your own database
 
Normalisation and anomalies
Normalisation and anomaliesNormalisation and anomalies
Normalisation and anomalies
 
Normalization
NormalizationNormalization
Normalization
 
Cis336 all i labs week 1 to week 7 devry university
Cis336 all i labs week 1 to week 7 devry universityCis336 all i labs week 1 to week 7 devry university
Cis336 all i labs week 1 to week 7 devry university
 

Viewers also liked

2016 10 01 CV Jie Lian
2016 10 01 CV Jie Lian2016 10 01 CV Jie Lian
2016 10 01 CV Jie LianJie Lian
 
nivea case
nivea case nivea case
nivea case
Ashuvyas2128
 
19 carmelo de grazia suárez bancamiga recomendaciones para tu seguridad
19 carmelo de grazia suárez bancamiga recomendaciones para tu seguridad19 carmelo de grazia suárez bancamiga recomendaciones para tu seguridad
19 carmelo de grazia suárez bancamiga recomendaciones para tu seguridad
Carmelo De Grazia Suárez
 
MEDICINA
MEDICINAMEDICINA
RAMYA KARUPPUSAMY (1)
RAMYA KARUPPUSAMY (1)RAMYA KARUPPUSAMY (1)
RAMYA KARUPPUSAMY (1)ammupapa
 
[Calidad] Definición e Importancia de la Calidad
[Calidad] Definición e Importancia de la Calidad[Calidad] Definición e Importancia de la Calidad
[Calidad] Definición e Importancia de la Calidad
Gabby Barocio
 
Epicurus and Lucretius on death and how to live well
Epicurus and Lucretius on death and how to live wellEpicurus and Lucretius on death and how to live well
Epicurus and Lucretius on death and how to live well
Christina Hendricks
 
Vijay Sagar Resume
Vijay Sagar  ResumeVijay Sagar  Resume
Vijay Sagar Resume
Vijay Sagar
 
Frictional clutch
Frictional clutchFrictional clutch
Frictional clutch
Chandresh Suthar
 
S4 tarea4 jubeo
S4 tarea4 jubeoS4 tarea4 jubeo
S4 tarea4 jubeo
lolitatao
 

Viewers also liked (12)

2016 10 01 CV Jie Lian
2016 10 01 CV Jie Lian2016 10 01 CV Jie Lian
2016 10 01 CV Jie Lian
 
nivea case
nivea case nivea case
nivea case
 
19 carmelo de grazia suárez bancamiga recomendaciones para tu seguridad
19 carmelo de grazia suárez bancamiga recomendaciones para tu seguridad19 carmelo de grazia suárez bancamiga recomendaciones para tu seguridad
19 carmelo de grazia suárez bancamiga recomendaciones para tu seguridad
 
MEDICINA
MEDICINAMEDICINA
MEDICINA
 
RAMYA KARUPPUSAMY (1)
RAMYA KARUPPUSAMY (1)RAMYA KARUPPUSAMY (1)
RAMYA KARUPPUSAMY (1)
 
[Calidad] Definición e Importancia de la Calidad
[Calidad] Definición e Importancia de la Calidad[Calidad] Definición e Importancia de la Calidad
[Calidad] Definición e Importancia de la Calidad
 
Sacpcmp certificate
Sacpcmp certificateSacpcmp certificate
Sacpcmp certificate
 
Epicurus and Lucretius on death and how to live well
Epicurus and Lucretius on death and how to live wellEpicurus and Lucretius on death and how to live well
Epicurus and Lucretius on death and how to live well
 
Vijay Sagar Resume
Vijay Sagar  ResumeVijay Sagar  Resume
Vijay Sagar Resume
 
Frictional clutch
Frictional clutchFrictional clutch
Frictional clutch
 
pavi resume (2) (1)
pavi resume (2) (1)pavi resume (2) (1)
pavi resume (2) (1)
 
S4 tarea4 jubeo
S4 tarea4 jubeoS4 tarea4 jubeo
S4 tarea4 jubeo
 

Similar to Databases

Topics-Ch4Ch5.ppt
Topics-Ch4Ch5.pptTopics-Ch4Ch5.ppt
Topics-Ch4Ch5.ppt
ahmadfaisal744721
 
Topics-Ch4Ch5.ppt
Topics-Ch4Ch5.pptTopics-Ch4Ch5.ppt
Topics-Ch4Ch5.ppt
ahmadfaisal744721
 
2 Relational Database Concepts.ppt
2 Relational Database Concepts.ppt2 Relational Database Concepts.ppt
2 Relational Database Concepts.ppt
Souha Bennani
 
Database Concepts and Terminologies
Database Concepts and TerminologiesDatabase Concepts and Terminologies
Database Concepts and Terminologies
Ousman Faal
 
CS1100 Access Lab 1 Creating and Querying Database.docx
CS1100 Access Lab 1  Creating and Querying Database.docxCS1100 Access Lab 1  Creating and Querying Database.docx
CS1100 Access Lab 1 Creating and Querying Database.docx
faithxdunce63732
 
Database Fundamentals
Database FundamentalsDatabase Fundamentals
Database Fundamentalswmassie
 
Lesson One - Why do I need a Database
Lesson One - Why do I need a DatabaseLesson One - Why do I need a Database
Lesson One - Why do I need a Databaseguevarra_2000
 
18 database features
18 database features18 database features
18 database featuresRebecca Jones
 
Database fundamentals
Database fundamentalsDatabase fundamentals
Database fundamentalscrystalpullen
 
Databasell
DatabasellDatabasell
Databasell
Anwar Bilcha
 
10359485
1035948510359485
10359485kavumo
 
MS ACCESS Tutorials
MS ACCESS TutorialsMS ACCESS Tutorials
MS ACCESS Tutorials
Duj Law
 
Relational Databases
Relational DatabasesRelational Databases
Relational DatabasesJason Hando
 
Database Basics
Database BasicsDatabase Basics
Database Basics
Abdel Moneim Emad
 

Similar to Databases (20)

Topics-Ch4Ch5.ppt
Topics-Ch4Ch5.pptTopics-Ch4Ch5.ppt
Topics-Ch4Ch5.ppt
 
Topics-Ch4Ch5.ppt
Topics-Ch4Ch5.pptTopics-Ch4Ch5.ppt
Topics-Ch4Ch5.ppt
 
2 Relational Database Concepts.ppt
2 Relational Database Concepts.ppt2 Relational Database Concepts.ppt
2 Relational Database Concepts.ppt
 
Database Concepts and Terminologies
Database Concepts and TerminologiesDatabase Concepts and Terminologies
Database Concepts and Terminologies
 
CS1100 Access Lab 1 Creating and Querying Database.docx
CS1100 Access Lab 1  Creating and Querying Database.docxCS1100 Access Lab 1  Creating and Querying Database.docx
CS1100 Access Lab 1 Creating and Querying Database.docx
 
Databases
DatabasesDatabases
Databases
 
Access 2010
Access 2010Access 2010
Access 2010
 
Database Fundamentals
Database FundamentalsDatabase Fundamentals
Database Fundamentals
 
Lesson One - Why do I need a Database
Lesson One - Why do I need a DatabaseLesson One - Why do I need a Database
Lesson One - Why do I need a Database
 
18 database features
18 database features18 database features
18 database features
 
Database
DatabaseDatabase
Database
 
Database design
Database designDatabase design
Database design
 
Database fundamentals
Database fundamentalsDatabase fundamentals
Database fundamentals
 
Databasell
DatabasellDatabasell
Databasell
 
10359485
1035948510359485
10359485
 
MS ACCESS Tutorials
MS ACCESS TutorialsMS ACCESS Tutorials
MS ACCESS Tutorials
 
Relational Databases
Relational DatabasesRelational Databases
Relational Databases
 
Database Basics
Database BasicsDatabase Basics
Database Basics
 
Database design
Database designDatabase design
Database design
 
Database design
Database designDatabase design
Database design
 

More from odalyfer

Mind map and design
Mind map and designMind map and design
Mind map and design
odalyfer
 
Finances
FinancesFinances
Finances
odalyfer
 
Mind map and design
Mind map and designMind map and design
Mind map and design
odalyfer
 
Brief and gantt chart
Brief and gantt chartBrief and gantt chart
Brief and gantt chart
odalyfer
 
The systems life cycle
The systems life cycleThe systems life cycle
The systems life cycleodalyfer
 
The effects of using ict
The effects of using ictThe effects of using ict
The effects of using ictodalyfer
 

More from odalyfer (6)

Mind map and design
Mind map and designMind map and design
Mind map and design
 
Finances
FinancesFinances
Finances
 
Mind map and design
Mind map and designMind map and design
Mind map and design
 
Brief and gantt chart
Brief and gantt chartBrief and gantt chart
Brief and gantt chart
 
The systems life cycle
The systems life cycleThe systems life cycle
The systems life cycle
 
The effects of using ict
The effects of using ictThe effects of using ict
The effects of using ict
 

Recently uploaded

Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
Fundacja Rozwoju Społeczeństwa Przedsiębiorczego
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
Celine George
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
Steve Thomason
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
PedroFerreira53928
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
bennyroshan06
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 

Recently uploaded (20)

Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 

Databases

  • 1. Basic Database Concepts By Odaly Fernandez
  • 2. What is a database  A database is any collection of information (data).  This collection represents part of the real world.  The data is organized in some manner so that the information contained within the database can be easily retrieved.
  • 3. Examples of database  Phone books  Library  School  Search engines
  • 4. Relational Database Modelling  Uses a collection of tables to represent both data and the relationship among those data  Each table has multiple columns  Each column has a unique name
  • 5. Relational database – Basic concepts EMPLOYEE table (collection of related records) EmployeeID Name Hire Date 1122 Bill White 1/1/2001 2387 Ron Smith 27/9/2001 4456 Greg King 24/8/1999 CUSTOMER table CustomerID Name Address Phone 100 Lyons 123 A Street 916-444-55 101 Dennys 435 Elm Street 916-478-23 102 IHOP 654 17th Av. 916-458-77 ORDERS table Order Number CustomerID EmployeeID Cost 101 100 1122 23.78 € 145 100 2387 100.25 € 152 102 2387 54.89 € Record (collection of related fields) Field (a single piece of information)
  • 6. Database Management System (DBMS)  Software that allows users to create, maintain, and query your data in the related tables  Examples: MS Access, Oracle, FoxPro, MySql
  • 7. Primary and foreign keys  Primary Key, a value that is unique to each record  Foreign Key, a primary key of one table included in another table. Link tables to each other.  Find the PK and FK on the last relational database example.
  • 8. Referential Integrity  Referential integrity is a database concept that ensures that relationships between tables remain consistent.  What happens if:  Marketing’s DID is changed to 16 in DEPARTMENT?  The entry for Accounts is deleted from DEPARTMENT? DID DName 13 Marketing 14 Accounts 15 Personnel EID EName DID 1515 John Smith 13 1600 Mary Brown 14 1717 Mark Jones 13 1800 Jane Smith 13 DEPARTMENT EMPLOYEE
  • 9. Types of relationships One to one An entity in A is associated with at most one entity in B, and an entity in B is associated with at most one entity in A a1 a2 a3 a4 b1 b2 b3 b4 A B
  • 10. One to one examples  Husband and wife  Person and passport  Teachers and computers
  • 11. Types of relationships One to many An entity in A is associated with any number (zero or more) of entities in B. An entity in B, however, can be associated with at most one entity in A a1 a2 a3 a4 b1 b2 b3 b4 b5 A B
  • 12. One to many examples  Mother - children  One department contains many employees, but one employee works in one department only.  Customers – orders  Car - owner
  • 13. Types of relationships Many to many An entity in A is associated with any number (zero or more) of entities in B, and an entity in B is associated with any number of entities in A a1 a2 a3 a4 b1 b2 b3 b4 b5 A B
  • 14. Many to many examples  Each student takes several subjects, and each subject is taken by several students.  Authors – Books  A project can have many employees working on it. And, an employee can work on many projects.  In a library, a book can be borrowed by many borrowers. A borrower can borrow many books.
  • 15. Types of relationships  In a database we store information about books, the authors, the category of the books, and the publishers.  A book can have more than one author.  A book can be of more than one category.  A publisher publishes many books. A book is published only for one publisher.  What types of relationships do we have here?
  • 16. Designing a database structure  As you are gathering information in the requirements phase, you should be thinking about these items:  Identify all of the fields you are going to need and ways to organize the related fields into tables  Determine or build a primary key for each table if needed
  • 17. Designing a database structure  Compare the two tables below. You will see situations that you want to avoid: 1) Avoid data redundancy. 2) If you can avoid data redundancy, you can avoid data mistakes. Look at the customer name for customer #635 in both tables. Two different spellings. Which one is correct? 3) Notice that there are two different customers in the Orders table that have the same customer number (#104). If your billing system uses the customer number to drive it, who’s going to get the bill? 4) Notice that some of the customers in the Orders table aren’t even listed in the Customer table. Will these customers ever get a bill?
  • 18. CUSTOMER table CustID Name Address Phone City State 104 Meadows Restaurant Pond Hill Rd 313-792 Monroe Mi 128 Grand River Restaurant 37 Queue Av. 313-729 Lacota MI 163 Bentham’s Restaurant 1366 36th St 517-792 Monroe MI 635 Oaks Restaurant 3300 West Russell St 419-336 Maumee OH 741 Prime Cut Steakhouse 2819 East 10th St 219-336 Mishawalka IN 779 Gateway Lounge 3408 Gateway B1 419-361 Sylvania OH ORDERS table OrdID CustID Name Billing Date Invoice Amount 202 104 Meadows Restaurant 15/1/12 1280.50 226 635 Oakes Restaurant 15/1/12 1939.00 231 779 Gateway Lounge 15/1/12 1392.50 309 741 Prime Cut Steakhouse 15/2/12 1928.00 313 104 Stokes Inn 15/2/12 1545.00 377 128 Grand River Restaurant 15/3/12 562.00 359 635 Raks Restaurant 15/3/12 1939.00 373 779 Gateway Lounge 15/3/12 1178.00
  • 19. Designing a database structure The South India Motor Company is designing a new database to store information on its employees, their job details and information about the branches in which they work. For each employee, it needs to hold information on the employee's name, their payroll number (which is unique to them and has two letters followed by four digits, the first letter is always M or C), the branch that they work at and the job that they perform. For each employee, the job code and description needs to be stored along with the rate of pay for that job. For each branch of the company, it needs to record the branch number, the branch name, the address and a weighting which is used to calculate salaries. This weighting ensures that employees living in areas where housing and other costs are high receive more pay than workers in areas where housing costs are lower. The weighting is a decimal value between 0 and 2. Design the structure of the database you would build to hold this data.
  • 20. Designing a database structure  Identify tables, fields, and relationships from the problem description.  How do I find tables and fields?  Tables and fields are often represented by nouns in the description
  • 21. Designing a database structure  How do I tell the difference between a table and a field?  Field values are atomic, so fields can't have smaller parts or be groups of things.  Fields can't participate in relationships.  Fields have a single value (a string, a number, etc), whereas tables have complex values (groups of fields generally).
  • 22. Designing a database structure  How do I find potential relationships between tables?  Relationships are often verbs or phrases that link two tables in the problem description.
  • 23. Designing a database structure  How do I determine the type of relationship?  Sometimes this is apparent from the description.  Sometimes it is less clear, and you need to think about what situations are possible.
  • 24. Designing a database structure So which are our tables? What data type should you use for each field? Which fields should be primary key? What relationships will be needed?
  • 25. Validation rules  Range check  Look-up check  Format check  Length check: passwords  Type check
  • 26. Data verification  There are two main methods of verification:  Double entry - entering the data twice and comparing the two copies.  Proofreading data - this method involves someone checking the data entered against the original document.