SlideShare a Scribd company logo
1 of 38
Features of Relational Databases
       A structured collection of related data.
        e.g.
         An address book
         A telephone directory
         A timetable
Databases are used to organise, store and retrieve
information as efficiently and effectively as possible.
Databases provide many benefits…
   Data is accessed more quickly
   Data has independence from the application
   Data can be shared between applications (so information only stored
    once – applications ‗dip‘ into the data)
   Data redundancy is prevented (that is, duplication of data)
   Data more accurate due to validation
   Data can be queried – SQL
   Reports easy to generate - wizards
   Forms easily created (which help shield the user from the complexity of
    the application)
   Storage of data more efficient
   Security of data better against intended/un-intended activity
   Backing up of data easy.
   Ensures all information is complete, accurate, relevant and timely.
Consider how information is stored in a
database File (Table)
           – A set of related records

          Record (Row)
          – A collection of data about
            an individual item

          Field (Column)
           – A single item of data
             common to all records
Each column represents a field within the
                             record




Each line
represents
a record
within the
table
   Prior to relational database technology, all
    databases were just files containing data.
   We call these flat files.
   Have a look at the example on the next
    slide and see if you can see what the
    problems are with having files like this…
   In the example for Sportswear Direct, five
    suppliers have been used to provide
    sportswear for the business
   Each time a purchase is made from a
    supplier, their name and address details
    have to be entered by the user
   Duplicating data entry can lead to
    mistakes or errors, e.g. incorrect street
    number or postcode
   A relational database could be used, which
    contained a Supplier table
   Supplier details could then be entered just
    once
   Each supplier could be given a unique
    identifying code, e.g. a Supplier ID
   The supplier could then be referred to by this
    unique code
   The code would become the ―Primary Key‖ of
    the Supplier table
Supplier Table
Using Supplier ID rather than name and
   To further reduce the likelihood of incorrect
    data and to reduce the amount of data
    being keyed in, users could be given a
    drop down menu to choose a supplier from
    those available
   Users should not be able to key in a
    supplier that does not exist on the Supplier
    table
Carry out some research:
 Find a suitable definition of a relational
  database

   Find more information about the purpose
    of a relational database

   Include these, with references, in your
    presentation
   We are now going to look at relational
    databases in more detail. We will cover:

   Entities

   Attributes

   Relationships

   Benefits
ENTITIES:
 Entities are real world objects that are of
  interest to the system, e.g. Customer
 You can hold information about these
  objects
 Entities become tables in databases

 Can you think of any other entities?
   A Primary Key is a data item which is
    unique and can be used to identify a
    record with certainty
   AutoCounter data items are often used to
    provide a primary key
   What are the problems with storing data in
    a table like this?
In this example no field contains unique data as in each
field data is repeated at least once
It is not possible to identify a record by one field
So, we add an ID field to provide a unique identifier
Foreign Key
 When a primary key is copied to another
  table to create a relationship, in the other
  table it is called a Foreign Key
 Linked keys provide an Access Path to
  establish if queries can be successfully
  made
 Linked keys allow data to be located and
  retrieved
PURCHASE        SUPPLIER
                 TABLE          TABLE

              Purchase Order   Supplier ID   Primary Key
Foreign Key          ID          Name
                Supplier ID     Address
                   Date         Postcode
                 Quantity      Telephone
                   Item         Number
                   Price



    Using the example we used earlier, the Foreign
    Key is the copy of the primary key from the
    Supplier Table
   Referential Integrity is when the system is
    checked to ensure that keys used in
    relationships do in fact exist
   If a copy of a primary key is used as a link in
    another table, then the value must exist in the
    original table
   Using our example, the supplier code must
    exist on the Supplier Table if it is used on the
    Purchase Table
   This ensures consistency between the data in
    linked tables
   Sometimes not all errors are found, and
    manual checks of the data may be needed
   Auto Number data types can be used to
    create a unique identifier for a table, e.g. for
    a primary key
   The sequence of these numbers always
    begins with the number one
   It is possible to set the initial value of a
    number sequence by using an Append query
   This involves creating a temporary table
    storing a single value showing where the
    auto number should start
ATTRIBUTES:
 Attributes are the properties of an entity, that
  is the information that you can hold about
  them, e.g. name, address, telephone number
 Attributes become columns or fields in a
  database table
 We will now look at some of the field
  properties:
     Field names
     Data types
     Field properties
     Validation rules
   Microsoft Access gives you lots of flexibility when it
    comes to naming your fields.
   A field can be 64 characters long
   A field can include any combination of letters,
    numbers, spaces and special characters.
   There are exceptions – a period (.), an exclamation
    point (!), an accent grave (`) and brackets ([ ]). You
    cannot begin with a space.
   Ensure you give fields meaningful names – not
    names internal to Access or VB as this may cause
    conflicts
   Create table and field names without embedded
    spaces – most SQL databases to which Access can
   Data types allow you to set properties and
    thereby customise a field in a database
   In Access, data types appear with default
    properties already in place
   Access supports 9 types of data – each
    with a specific purpose
   There is however a 10th option, Lookup
    Wizard, to help you define the
    characteristics of foreign key fields that
    link to other tables.
How the
table
looks in
Access,
showing
the data
types
   Text – normally selected for characters
   Memo – long strings of text (sentences &
    paragraphs)
   Number – used for numbers but think
    carefully about what you enter as the field
    size property because this will affect
    precision as well as length. E.g. Integers do
    not have decimals
   Date/Time – useful for calendar or clock data
    (allows calculations in minutes, seconds,
    hours, days, months or years)
   Currency – always use for storing money
    values. It has the precision of integers and
   AutoNumber – provides automatic
    generation of primary key values (random
    or sequential)
   Yes/No – used to hold true or false values
    (useful for flagging accounts paid / not
    paid etc)
   OLE Object – allows you to store
    complex data such as pictures and graphs
    etc.
   Hyperlink – allows you to store a simple
    or complex link to an external file or
Property            Description
Field Size          Fixes the Max length of a text field
                    The default value is 50 characters
                    The maximum length is 255
Format              This fixes how the data can be displayed
Input Mask          This sets a pattern for the data to be entered
Caption             This is the field label in a form or report
Default Value       This is the value entered into a field when the record is created
                    It is usually left blank but can be very powerful
Validation Rule     This defines the data entry rules
Validation Text     This is the error message if data is invalid
Required            This indicates whether an entry must be made or not.
                    If an entry is required, it is best not to set this property until the
                    database is fully working
Indexed           This allows data to be sorted in the order of this filed which
                  speeds up searches
Allow Zero Length This is used with text fields to decide whether records in that
                  field are allowed to contain zero length or empty text strings
Source: Microsoft
http://office.microsoft.com/en-us/access-help/create-a-validation-rule-to-validate-data-in-a-field-
HA010096312.aspx [Accessed 28/04/11]

   A validation rule limits or controls what users
    can enter in a table field or a control (such as
    a text box) on a form.
   Microsoft Office Access 2007 provides a
    number of ways to validate data, and you
    often use several of those techniques to
    define a validation rule. You can think of
    validation rules as a set of layers — you can
    use some or all of the layers when you need
    to ensure that your users enter data properly.
Data types
 The data type restricts what users can enter.
  For example, a Date/Time field accepts only
  dates and times, a Currency field accepts
  only monetary data, etc
Field sizes
 Setting a maximum field size can prevent
  unnecessary data being entered, e.g. by
  setting a field that stores first names to a
  maximum of 20 characters can prevent an
  inexperienced user from mistakenly entering
  a first and last name in a field designed only
  to hold a first name.
Table properties
 Table properties provide very specific types of
  validation. For example, you can set the Required
  property to Yes and, as a result, force users to
  enter a value in a field.
Validation Rule
 Use this property to only allow specific values, and
  the Validation Text property to alert your users to
  any mistakes. For example, entering a rule such
  as >100 And <1000 in the Validation Rule
  property forces users to enter values between 100
  and 1,000. The Validation Text property tells
  users when they have made a mistake and how to
Input masks
 You can use an input mask to validate
  data by forcing users to enter values in a
  specific way. For example, an input mask
  can force users to enter dates in a
  European format, such as 2007.04.14.

Source: Microsoft
http://office.microsoft.com/en-us/access-help/create-a-validation-rule-to-validate-
data-in-a-field-HA010096312.aspx [Accessed 28/04/11]
   The term relationship is used to identify the
    link between two database tables
   The link is created by creating a record that
    contains the primary key from its own table and
    a copy of the primary key from another table
   Identifying and creating these links is the most
    fundamental requirements for database
    designers
   Failing to implement the correct relationships
    can have a detrimental effect on the efficiency
    and functionality of the final database
   We will look at the example we used earlier
Purchase Order
                                          Supplier ID
                 ID
                                            Name
            Supplier ID
                                           Address
               Date
                                           Postcode
             Quantity
                                          Telephone
               Item
                                           Number
               Price


                           Relationship

To link a supplier to a Purchase Order, the supplier‘s ID
is stored within the order. None of the other supplier
information is included on the purchase order.
   Relationships can be one of three types:

                   One to one

                   One to many, or many to one

                   Many to many
   A success database requires all relationships
    to be defined as one to many (or many to
    one) relationships.
   Any many to many relationships must be
    resolved until they become one to many (or
    many to one)
   One to one relationships often mean that one
    set of data belongs to the other in the link
    and is therefore an attribute
   Normalisation helps to correctly design
    relational databases.
   It is designed to:
       Remove repeating data (so data is stored more
        efficiently)
       Remove redundant data
       Remove many to many relationships
       Help identify the keys (primary key and foreign
        key)
   Normalisation will be covered in more detail
   Reduced data redundancy
   Reduced data storage
   Faster access
   Ease of data extraction
   Efficient updating
   Efficient searching
   Efficient sorting
   Efficient reporting

More Related Content

What's hot

What is SQL Server?
What is SQL Server?What is SQL Server?
What is SQL Server?CPD INDIA
 
Types of attributes (160210107054)
Types of attributes  (160210107054)Types of attributes  (160210107054)
Types of attributes (160210107054)ajay_483
 
2 database system concepts and architecture
2 database system concepts and architecture2 database system concepts and architecture
2 database system concepts and architectureKumar
 
Relational data base management system (Unit 1)
Relational data base management system (Unit 1)Relational data base management system (Unit 1)
Relational data base management system (Unit 1)Ismail Mukiibi
 
Types Of Keys in DBMS
Types Of Keys in DBMSTypes Of Keys in DBMS
Types Of Keys in DBMSPadamNepal1
 
Types of keys in dbms
Types of keys in dbmsTypes of keys in dbms
Types of keys in dbmsdarshhingu
 
3 Tier Architecture
3 Tier Architecture3 Tier Architecture
3 Tier Architectureguestd0cc01
 
Aggregate functions in SQL.pptx
Aggregate functions in SQL.pptxAggregate functions in SQL.pptx
Aggregate functions in SQL.pptxSherinRappai
 
9. Object Relational Databases in DBMS
9. Object Relational Databases in DBMS9. Object Relational Databases in DBMS
9. Object Relational Databases in DBMSkoolkampus
 
Sql(structured query language)
Sql(structured query language)Sql(structured query language)
Sql(structured query language)Ishucs
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMSkoolkampus
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScriptAndres Baravalle
 

What's hot (20)

What is SQL Server?
What is SQL Server?What is SQL Server?
What is SQL Server?
 
Sql commands
Sql commandsSql commands
Sql commands
 
Types of attributes (160210107054)
Types of attributes  (160210107054)Types of attributes  (160210107054)
Types of attributes (160210107054)
 
Database Keys
Database KeysDatabase Keys
Database Keys
 
2 database system concepts and architecture
2 database system concepts and architecture2 database system concepts and architecture
2 database system concepts and architecture
 
Sql commands
Sql commandsSql commands
Sql commands
 
Relational data base management system (Unit 1)
Relational data base management system (Unit 1)Relational data base management system (Unit 1)
Relational data base management system (Unit 1)
 
Create table
Create tableCreate table
Create table
 
Types Of Keys in DBMS
Types Of Keys in DBMSTypes Of Keys in DBMS
Types Of Keys in DBMS
 
Types of keys in dbms
Types of keys in dbmsTypes of keys in dbms
Types of keys in dbms
 
3 Tier Architecture
3 Tier Architecture3 Tier Architecture
3 Tier Architecture
 
Sql select
Sql select Sql select
Sql select
 
Aggregate functions in SQL.pptx
Aggregate functions in SQL.pptxAggregate functions in SQL.pptx
Aggregate functions in SQL.pptx
 
9. Object Relational Databases in DBMS
9. Object Relational Databases in DBMS9. Object Relational Databases in DBMS
9. Object Relational Databases in DBMS
 
Sdi & mdi
Sdi & mdiSdi & mdi
Sdi & mdi
 
Sql(structured query language)
Sql(structured query language)Sql(structured query language)
Sql(structured query language)
 
Introduction to sql
Introduction to sqlIntroduction to sql
Introduction to sql
 
Array in c#
Array in c#Array in c#
Array in c#
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 

Viewers also liked

Data Types And Field Properties
Data  Types And  Field  PropertiesData  Types And  Field  Properties
Data Types And Field Propertieswmassie
 
Datatypes, Field Properties, Validation and Masking
Datatypes, Field Properties, Validation and MaskingDatatypes, Field Properties, Validation and Masking
Datatypes, Field Properties, Validation and Maskingstarsmileygirl34
 
Types of databases
Types of databasesTypes of databases
Types of databasesPAQUIAAIZEL
 
Validation rule, validation text and input masks
Validation rule, validation text and input masksValidation rule, validation text and input masks
Validation rule, validation text and input masksfizahPhd
 
Data Types And Field Properties
Data Types And Field PropertiesData Types And Field Properties
Data Types And Field Propertieslindy23
 
4 Parts of a Data Base
4 Parts of a Data Base4 Parts of a Data Base
4 Parts of a Data BaseAM.joustra
 
BTEC National in ICT: Unit 3 - Introduction in Access
BTEC National in ICT: Unit 3 - Introduction in AccessBTEC National in ICT: Unit 3 - Introduction in Access
BTEC National in ICT: Unit 3 - Introduction in Accessmrcox
 
Unit 8, Assignment 2
Unit 8, Assignment 2Unit 8, Assignment 2
Unit 8, Assignment 2Emma McAneny
 
Unit 11-systems-analysis-and-design
Unit 11-systems-analysis-and-designUnit 11-systems-analysis-and-design
Unit 11-systems-analysis-and-designZile Mafantiri
 
Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)Oum Saokosal
 
Normalization
NormalizationNormalization
Normalizationochesing
 
E commerce full notes for mba
E commerce full notes for mba E commerce full notes for mba
E commerce full notes for mba karishma
 
Database management system
Database management systemDatabase management system
Database management systemRizwanHafeez
 
Features of windows operating system
Features of windows operating systemFeatures of windows operating system
Features of windows operating systemMohammad Alig
 

Viewers also liked (20)

Intro databases
Intro databasesIntro databases
Intro databases
 
Data Types And Field Properties
Data  Types And  Field  PropertiesData  Types And  Field  Properties
Data Types And Field Properties
 
Datatypes, Field Properties, Validation and Masking
Datatypes, Field Properties, Validation and MaskingDatatypes, Field Properties, Validation and Masking
Datatypes, Field Properties, Validation and Masking
 
Types of databases
Types of databasesTypes of databases
Types of databases
 
Validation rule, validation text and input masks
Validation rule, validation text and input masksValidation rule, validation text and input masks
Validation rule, validation text and input masks
 
Sorting databases
Sorting databasesSorting databases
Sorting databases
 
Data Types And Field Properties
Data Types And Field PropertiesData Types And Field Properties
Data Types And Field Properties
 
4 Parts of a Data Base
4 Parts of a Data Base4 Parts of a Data Base
4 Parts of a Data Base
 
BTEC National in ICT: Unit 3 - Introduction in Access
BTEC National in ICT: Unit 3 - Introduction in AccessBTEC National in ICT: Unit 3 - Introduction in Access
BTEC National in ICT: Unit 3 - Introduction in Access
 
Unit 8, Assignment 2
Unit 8, Assignment 2Unit 8, Assignment 2
Unit 8, Assignment 2
 
Unit 11-systems-analysis-and-design
Unit 11-systems-analysis-and-designUnit 11-systems-analysis-and-design
Unit 11-systems-analysis-and-design
 
Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)
 
Normalization
NormalizationNormalization
Normalization
 
Narrative theories
Narrative theoriesNarrative theories
Narrative theories
 
E commerce full notes for mba
E commerce full notes for mba E commerce full notes for mba
E commerce full notes for mba
 
E-business
E-businessE-business
E-business
 
Sql ppt
Sql pptSql ppt
Sql ppt
 
Databases: Normalisation
Databases: NormalisationDatabases: Normalisation
Databases: Normalisation
 
Database management system
Database management systemDatabase management system
Database management system
 
Features of windows operating system
Features of windows operating systemFeatures of windows operating system
Features of windows operating system
 

Similar to 18 database features (20)

Database Concepts and Terminologies
Database Concepts and TerminologiesDatabase Concepts and Terminologies
Database Concepts and Terminologies
 
01 Microsoft Access
01 Microsoft Access01 Microsoft Access
01 Microsoft Access
 
Databases By ZAK
Databases By ZAKDatabases By ZAK
Databases By ZAK
 
DB Keys.ppt
DB Keys.pptDB Keys.ppt
DB Keys.ppt
 
DB Keys.ppt
DB Keys.pptDB Keys.ppt
DB Keys.ppt
 
Physical elements of data
Physical elements of dataPhysical elements of data
Physical elements of data
 
Database Basics
Database BasicsDatabase Basics
Database Basics
 
Cis145 Final Review
Cis145 Final ReviewCis145 Final Review
Cis145 Final Review
 
CIS145 Final Review
CIS145 Final ReviewCIS145 Final Review
CIS145 Final Review
 
Data processing
Data processingData processing
Data processing
 
CIS 145 test 1 review
CIS 145 test 1 reviewCIS 145 test 1 review
CIS 145 test 1 review
 
Ayush presentation
Ayush presentationAyush presentation
Ayush presentation
 
Create a table access - office
Create a table   access - officeCreate a table   access - office
Create a table access - office
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
 
Cis145 Final Review
Cis145 Final ReviewCis145 Final Review
Cis145 Final Review
 
Fg d
Fg dFg d
Fg d
 
Ms access
Ms accessMs access
Ms access
 
Database
Database Database
Database
 
Intro to Data warehousing lecture 12
Intro to Data warehousing   lecture 12Intro to Data warehousing   lecture 12
Intro to Data warehousing lecture 12
 
Access 2010
Access 2010Access 2010
Access 2010
 

More from Rebecca Jones

P2 functions and equations from a graph questions
P2  functions and equations from a graph questionsP2  functions and equations from a graph questions
P2 functions and equations from a graph questionsRebecca Jones
 
04 access howtobuttons
04 access howtobuttons04 access howtobuttons
04 access howtobuttonsRebecca Jones
 
03 access howtofrmmaster
03 access howtofrmmaster03 access howtofrmmaster
03 access howtofrmmasterRebecca Jones
 
02 access howtobasicforms
02 access howtobasicforms02 access howtobasicforms
02 access howtobasicformsRebecca Jones
 
01 access howtointroduction
01 access howtointroduction01 access howtointroduction
01 access howtointroductionRebecca Jones
 
Fractions decimals percentages multiple choice quiz
Fractions decimals percentages multiple choice quizFractions decimals percentages multiple choice quiz
Fractions decimals percentages multiple choice quizRebecca Jones
 
03 analysis of_requirementsspecification
03 analysis of_requirementsspecification03 analysis of_requirementsspecification
03 analysis of_requirementsspecificationRebecca Jones
 
Software development lifecycle
Software development lifecycleSoftware development lifecycle
Software development lifecycleRebecca Jones
 
Btec unit 1 the online world learning aim b
Btec unit 1  the online world learning aim bBtec unit 1  the online world learning aim b
Btec unit 1 the online world learning aim bRebecca Jones
 
Intro to functional_skills_and_learning_log
Intro to functional_skills_and_learning_logIntro to functional_skills_and_learning_log
Intro to functional_skills_and_learning_logRebecca Jones
 
Pt induction slides 2014
Pt induction slides 2014Pt induction slides 2014
Pt induction slides 2014Rebecca Jones
 
Pt induction slides 2014
Pt induction slides 2014Pt induction slides 2014
Pt induction slides 2014Rebecca Jones
 
08 e commerce entities
08 e commerce entities08 e commerce entities
08 e commerce entitiesRebecca Jones
 
08 benefits of e-commerce
08 benefits of e-commerce08 benefits of e-commerce
08 benefits of e-commerceRebecca Jones
 
Employee management-security-controls
Employee management-security-controlsEmployee management-security-controls
Employee management-security-controlsRebecca Jones
 
Securityand encryption
Securityand encryptionSecurityand encryption
Securityand encryptionRebecca Jones
 

More from Rebecca Jones (20)

P2 functions and equations from a graph questions
P2  functions and equations from a graph questionsP2  functions and equations from a graph questions
P2 functions and equations from a graph questions
 
04 access howtobuttons
04 access howtobuttons04 access howtobuttons
04 access howtobuttons
 
03 access howtofrmmaster
03 access howtofrmmaster03 access howtofrmmaster
03 access howtofrmmaster
 
02 access howtobasicforms
02 access howtobasicforms02 access howtobasicforms
02 access howtobasicforms
 
01 access howtointroduction
01 access howtointroduction01 access howtointroduction
01 access howtointroduction
 
Fractions decimals percentages multiple choice quiz
Fractions decimals percentages multiple choice quizFractions decimals percentages multiple choice quiz
Fractions decimals percentages multiple choice quiz
 
03 analysis of_requirementsspecification
03 analysis of_requirementsspecification03 analysis of_requirementsspecification
03 analysis of_requirementsspecification
 
Software development lifecycle
Software development lifecycleSoftware development lifecycle
Software development lifecycle
 
Btec unit 1 the online world learning aim b
Btec unit 1  the online world learning aim bBtec unit 1  the online world learning aim b
Btec unit 1 the online world learning aim b
 
Ecommerce Security
Ecommerce SecurityEcommerce Security
Ecommerce Security
 
Intro to functional_skills_and_learning_log
Intro to functional_skills_and_learning_logIntro to functional_skills_and_learning_log
Intro to functional_skills_and_learning_log
 
Pt induction slides 2014
Pt induction slides 2014Pt induction slides 2014
Pt induction slides 2014
 
Pt induction slides 2014
Pt induction slides 2014Pt induction slides 2014
Pt induction slides 2014
 
08 e commerce entities
08 e commerce entities08 e commerce entities
08 e commerce entities
 
08 benefits of e-commerce
08 benefits of e-commerce08 benefits of e-commerce
08 benefits of e-commerce
 
1.4 adaptations
1.4 adaptations1.4 adaptations
1.4 adaptations
 
Codesof practice
Codesof practiceCodesof practice
Codesof practice
 
Employee management-security-controls
Employee management-security-controlsEmployee management-security-controls
Employee management-security-controls
 
Securityand encryption
Securityand encryptionSecurityand encryption
Securityand encryption
 
Layers of control
Layers of controlLayers of control
Layers of control
 

18 database features

  • 2. A structured collection of related data. e.g.  An address book  A telephone directory  A timetable
  • 3. Databases are used to organise, store and retrieve information as efficiently and effectively as possible. Databases provide many benefits…  Data is accessed more quickly  Data has independence from the application  Data can be shared between applications (so information only stored once – applications ‗dip‘ into the data)  Data redundancy is prevented (that is, duplication of data)  Data more accurate due to validation  Data can be queried – SQL  Reports easy to generate - wizards  Forms easily created (which help shield the user from the complexity of the application)  Storage of data more efficient  Security of data better against intended/un-intended activity  Backing up of data easy.  Ensures all information is complete, accurate, relevant and timely.
  • 4. Consider how information is stored in a database File (Table) – A set of related records Record (Row) – A collection of data about an individual item Field (Column) – A single item of data common to all records
  • 5. Each column represents a field within the record Each line represents a record within the table
  • 6. Prior to relational database technology, all databases were just files containing data.  We call these flat files.  Have a look at the example on the next slide and see if you can see what the problems are with having files like this…
  • 7.
  • 8. In the example for Sportswear Direct, five suppliers have been used to provide sportswear for the business  Each time a purchase is made from a supplier, their name and address details have to be entered by the user  Duplicating data entry can lead to mistakes or errors, e.g. incorrect street number or postcode
  • 9. A relational database could be used, which contained a Supplier table  Supplier details could then be entered just once  Each supplier could be given a unique identifying code, e.g. a Supplier ID  The supplier could then be referred to by this unique code  The code would become the ―Primary Key‖ of the Supplier table
  • 11. Using Supplier ID rather than name and
  • 12. To further reduce the likelihood of incorrect data and to reduce the amount of data being keyed in, users could be given a drop down menu to choose a supplier from those available  Users should not be able to key in a supplier that does not exist on the Supplier table
  • 13. Carry out some research:  Find a suitable definition of a relational database  Find more information about the purpose of a relational database  Include these, with references, in your presentation
  • 14. We are now going to look at relational databases in more detail. We will cover:  Entities  Attributes  Relationships  Benefits
  • 15. ENTITIES:  Entities are real world objects that are of interest to the system, e.g. Customer  You can hold information about these objects  Entities become tables in databases  Can you think of any other entities?
  • 16. A Primary Key is a data item which is unique and can be used to identify a record with certainty  AutoCounter data items are often used to provide a primary key  What are the problems with storing data in a table like this?
  • 17. In this example no field contains unique data as in each field data is repeated at least once It is not possible to identify a record by one field So, we add an ID field to provide a unique identifier
  • 18. Foreign Key  When a primary key is copied to another table to create a relationship, in the other table it is called a Foreign Key  Linked keys provide an Access Path to establish if queries can be successfully made  Linked keys allow data to be located and retrieved
  • 19. PURCHASE SUPPLIER TABLE TABLE Purchase Order Supplier ID Primary Key Foreign Key ID Name Supplier ID Address Date Postcode Quantity Telephone Item Number Price Using the example we used earlier, the Foreign Key is the copy of the primary key from the Supplier Table
  • 20. Referential Integrity is when the system is checked to ensure that keys used in relationships do in fact exist  If a copy of a primary key is used as a link in another table, then the value must exist in the original table  Using our example, the supplier code must exist on the Supplier Table if it is used on the Purchase Table  This ensures consistency between the data in linked tables  Sometimes not all errors are found, and manual checks of the data may be needed
  • 21. Auto Number data types can be used to create a unique identifier for a table, e.g. for a primary key  The sequence of these numbers always begins with the number one  It is possible to set the initial value of a number sequence by using an Append query  This involves creating a temporary table storing a single value showing where the auto number should start
  • 22. ATTRIBUTES:  Attributes are the properties of an entity, that is the information that you can hold about them, e.g. name, address, telephone number  Attributes become columns or fields in a database table  We will now look at some of the field properties:  Field names  Data types  Field properties  Validation rules
  • 23. Microsoft Access gives you lots of flexibility when it comes to naming your fields.  A field can be 64 characters long  A field can include any combination of letters, numbers, spaces and special characters.  There are exceptions – a period (.), an exclamation point (!), an accent grave (`) and brackets ([ ]). You cannot begin with a space.  Ensure you give fields meaningful names – not names internal to Access or VB as this may cause conflicts  Create table and field names without embedded spaces – most SQL databases to which Access can
  • 24. Data types allow you to set properties and thereby customise a field in a database  In Access, data types appear with default properties already in place  Access supports 9 types of data – each with a specific purpose  There is however a 10th option, Lookup Wizard, to help you define the characteristics of foreign key fields that link to other tables.
  • 26. Text – normally selected for characters  Memo – long strings of text (sentences & paragraphs)  Number – used for numbers but think carefully about what you enter as the field size property because this will affect precision as well as length. E.g. Integers do not have decimals  Date/Time – useful for calendar or clock data (allows calculations in minutes, seconds, hours, days, months or years)  Currency – always use for storing money values. It has the precision of integers and
  • 27. AutoNumber – provides automatic generation of primary key values (random or sequential)  Yes/No – used to hold true or false values (useful for flagging accounts paid / not paid etc)  OLE Object – allows you to store complex data such as pictures and graphs etc.  Hyperlink – allows you to store a simple or complex link to an external file or
  • 28. Property Description Field Size Fixes the Max length of a text field The default value is 50 characters The maximum length is 255 Format This fixes how the data can be displayed Input Mask This sets a pattern for the data to be entered Caption This is the field label in a form or report Default Value This is the value entered into a field when the record is created It is usually left blank but can be very powerful Validation Rule This defines the data entry rules Validation Text This is the error message if data is invalid Required This indicates whether an entry must be made or not. If an entry is required, it is best not to set this property until the database is fully working Indexed This allows data to be sorted in the order of this filed which speeds up searches Allow Zero Length This is used with text fields to decide whether records in that field are allowed to contain zero length or empty text strings
  • 29. Source: Microsoft http://office.microsoft.com/en-us/access-help/create-a-validation-rule-to-validate-data-in-a-field- HA010096312.aspx [Accessed 28/04/11]  A validation rule limits or controls what users can enter in a table field or a control (such as a text box) on a form.  Microsoft Office Access 2007 provides a number of ways to validate data, and you often use several of those techniques to define a validation rule. You can think of validation rules as a set of layers — you can use some or all of the layers when you need to ensure that your users enter data properly.
  • 30. Data types  The data type restricts what users can enter. For example, a Date/Time field accepts only dates and times, a Currency field accepts only monetary data, etc Field sizes  Setting a maximum field size can prevent unnecessary data being entered, e.g. by setting a field that stores first names to a maximum of 20 characters can prevent an inexperienced user from mistakenly entering a first and last name in a field designed only to hold a first name.
  • 31. Table properties  Table properties provide very specific types of validation. For example, you can set the Required property to Yes and, as a result, force users to enter a value in a field. Validation Rule  Use this property to only allow specific values, and the Validation Text property to alert your users to any mistakes. For example, entering a rule such as >100 And <1000 in the Validation Rule property forces users to enter values between 100 and 1,000. The Validation Text property tells users when they have made a mistake and how to
  • 32. Input masks  You can use an input mask to validate data by forcing users to enter values in a specific way. For example, an input mask can force users to enter dates in a European format, such as 2007.04.14. Source: Microsoft http://office.microsoft.com/en-us/access-help/create-a-validation-rule-to-validate- data-in-a-field-HA010096312.aspx [Accessed 28/04/11]
  • 33. The term relationship is used to identify the link between two database tables  The link is created by creating a record that contains the primary key from its own table and a copy of the primary key from another table  Identifying and creating these links is the most fundamental requirements for database designers  Failing to implement the correct relationships can have a detrimental effect on the efficiency and functionality of the final database  We will look at the example we used earlier
  • 34. Purchase Order Supplier ID ID Name Supplier ID Address Date Postcode Quantity Telephone Item Number Price Relationship To link a supplier to a Purchase Order, the supplier‘s ID is stored within the order. None of the other supplier information is included on the purchase order.
  • 35. Relationships can be one of three types:  One to one  One to many, or many to one  Many to many
  • 36. A success database requires all relationships to be defined as one to many (or many to one) relationships.  Any many to many relationships must be resolved until they become one to many (or many to one)  One to one relationships often mean that one set of data belongs to the other in the link and is therefore an attribute
  • 37. Normalisation helps to correctly design relational databases.  It is designed to:  Remove repeating data (so data is stored more efficiently)  Remove redundant data  Remove many to many relationships  Help identify the keys (primary key and foreign key)  Normalisation will be covered in more detail
  • 38. Reduced data redundancy  Reduced data storage  Faster access  Ease of data extraction  Efficient updating  Efficient searching  Efficient sorting  Efficient reporting