Download as pdf or txt
Download as pdf or txt
You are on page 1of 20

Database design and concepts

Module 4.1
Databases are commonly used

 We use (non electronic) databases every day in the


form of:
 Telephone directory
 Recipe books
 Filing systems using filing cabinets
 Limitations:
 Uses enormous space
 Locating specific data may waste time
Digital databases to the rescue

 Digital format offers solutions to:


 Storage space
 Accuracy
 Efficiency
 And has led to
 Various design strategies
 The most popular is relational database design!
Basic rules of relational databases

 Data stored in tables


 Each table represents a single concept
 Each item in a table is an instance of the entity: a record
 A record consists of attributes of the entity: fields
 Each record must be uniquely identified: primary key field
 Primary key can consist of more than one field
 Each record may contain field to link it: foreign key
 No field may appear more than once in a table
 Only foreign key field may appear in more than one table
To make data manageable we:

 Select it
 select only some data to work with
 select only that which is relevant to what the entity is
about
 Structure it
 decide which tables we need
 what relationships must exist between tables
Normalisation

 Reasons for normalisation:


 Making sure that no data is repeated
 Making sure queries and reports can be easily created
 Normalisation is:
 To make formal rules
 Applied in a specific order – called specific names
 To ensure correct database design
Basic database design:
Selecting the data

 Figure out what data you need


 Refer to existing documents
 Identify types of input and output the system will deal with
 Identify types of data you will need
 Give appropriate heading to each piece of information
 Existing workflows
 Identifies the order in which things get done
 Helps to understand flow of data
 Business plan
 Outlines strategies to make business a success
 Identifies data needed that may not be obvious
Activity 1
Analyse the following
documents to extract the
data required to create them.
Basic database design:
Structuring data (1)

 Figure out the best ways to organise the data


 Study an existing source, e.g a price list as below
Basic database design:
Structuring data (2)

 Not suitable to change each heading into a field


because:
 Multiple values appear in one field
 Same data repeated as different fields of a record
PubID PubName ContactNo Product1 Product2 Product3 Product4
SOP864 Study 012 565-6469 CATGr10; 978-1- CATGr10TG&DVD; 978-1- RTTGr10; 978-1- RTTGr10OG&DVD;
Opportunities 919867-80-9; 919867-81-6; Computers, 919867-82-3; 978-1-919867-83-0;
Computers, part of part of your life – Grade Rekenaars, deel van Rekenaars, deel van
your life – Grade 10; 10 Teacher’s Guide & jou lewe – Graad 10; jou lewe – Graad 10
CAT; R185.00 DVD; CAT; R215.00 RTT; R185.00 Onderwysergids &
DVD; RTT; R215 .00

OSB542 Osborne 011 622-7512 DATASELF; 0-07- FUNDDATA; 08-227364-


225364-9; Databases 2; Fundamentals of data
Demystified; IT; structures; IT; R500.60
R360.00
Basic database design:
Structuring data (3)

 Normalise to ensure
 Each field contains a single value
 Data is not repeated as fields of the same record. E.g.

PubID PubName ContactNo ProdCode ISBN Name Category Price


SOP864 Study 012 565-6469 CATGr10 978-1- Computers, part of CAT R185.00
Opportunities 919867-80- your life – Grade 10
9
OSB542 Osborne 011 622-7512 DATASELF 0-07- Databases IT R360.00
225364-9 Demystified

 This table is still not suitable, as errors will occur.


Basic database design:
Structuring data (4)

Errors:
 Insert anomaly
 Prevents user from capturing data as needed
 If publisher data is to be added at least one product will be
added
 Delete anomaly
 Deleting one piece will result in simutaneously deleting
unrelated data
 If one item of stock is removed it will remove the details of
the publisher
 Update anomaly
 If data changes it has to be changed in more than one record
 If a telephone number of a publisher changes it will have to
be changed across more than one record
Basic database design:
Structuring data (5)

 Solutions to problems:
 Separate data from publishers and products to two
tables (two separate entities)
 Determine the relationship
 Link using a foreign key
Basic database design:
Result of redesign

 Increases efficiency
 Minimises wasted storage and memory
 Eliminates errors
 Eliminates inconsistencies in data
 Makes data maintenance easier
 Do not have to search for repeated entries
 Do not have to enter the same data more than once
 Deleting one record will not corrupt the whole database
Concepts that improve design
Data integrity
Maintain accuracy and consistency – achieved by
normalisation
 Physical integrity
 Overcome practical issues such as power failure, natural
disasters etc.
 Using technologies such as UPS and RAID
 Logical integrity
 Correctness of data
 Data making sense in a particular context
Concepts that improve design
Data integrity

 Transaction processing used to maintain data


integrity
 Software system that captures and processes data from
everyday business activities
 Transactions depending on one another are grouped
together – like bank account, credit card, debit card
 Operation is only completed if all individual transactions
are successful
 If not successful all the transactions are reversed – all in
the same state it was before the attempt was made
Concepts that improve design
Data redundancy

 Unnecessary repetition of data across fields in a


database
 Can lead to update anomalies

 Intentional duplication of data across multiple


storage media (e.g. mirroring)
 Ensures that data is available even if one storage
medium fails
Concepts that improve design
Data independence
 Physical independence
 Application processing data can deal with all media
 Logical independence
 Existing applications not affected by adding tables or extra
fields to the database

 Aims of data independence


 The user application cannot change tables or fields
 Multiple applications can interface to the same data
 The actual data management is left to the DBMS
software
Concepts that improve design
Data security

 Protection against loss/theft


 Control of physical access to computers.
 Protected against unauthorised access
 Access control
 Password control – no password, no access
 Access rights – what can be viewed; who can change data,
etc.
 Data encryption – to protect data against unauthorised
users who get past passwords and access rights
Activity 2
Answer the questions

You might also like