Docstoc

Introduction To Database System Concepts

Document Sample
Introduction To Database System Concepts Powered By Docstoc
					G057 - Lecture 02

Introduction To Database
System Concepts

               Mr C Johnston
                  ICT Teacher
             www.computechedu.co.uk
       Session Objectives
   Learn about database terminology.
   To learn the basic relational database components and
    concepts
   To become familiar with the relational tables components
    and characteristics
   To learn how keys are used in the relational database
    environment
   To examine basic entity relationships
   To draw basic entity relationships
         Databases and DBMS
   A database is a collection of data
   Databases need to be managed by computer software known
    as a Database Management System (DBMS)
   The DBMS is responsible for allowing you to CRUD (Create
    Read Update Delete) the data
   Microsoft Access is an example of a DBMS - not a database.
           A Logical View Of Data
   An entity is a person, place, event, or thing for which we
    intend to collect data
       Within a university entities could be – A Student, Faculty Member,
        Course or module
       An airline may have these entities – A Passenger, Pilot, Aircraft,
        Route or Supplier
   Each entity has a number of characteristics which are known
    as attributes
       A Student could have – A Student ID, Name, DOB, Home Address,
       An Aircraft could have – An Aircraft ID Number, hours flown, last
        maintenance date,

          Notice that entities are singular as they represent
          ONE item of data
           A Logical View Of Data
   Entities normally have a number of instances or occurrences
    which makes sense as lots of students make up a school,
   This is know as an entity set.
       The STUDENT entity set contains all the student entities
       The FACULTY entity set contains all the faculty entities
       The AIRCRAFT entity set contains all the aircraft entities
   An entity set is known when we design databases as a table.
Summary of A Relational Table
            Database Keys
   Each entity needs a primary key,
   This is an attribute which can be used as a unique identifier
    for a single entity occurrence,
        studentID could be a primary key for a STUDENT entity
   Entities can also have secondary keys,
   A secondary key is used to make an index of attributes which
    are commonly searched or sorted on,
        studentName could be a secondary key for the STUDENT set of entities
   keys also help define relationships between entities,
   When a relationship is formed between entities the primary
    key of one will appear as a foreign key in another to create a
    link.
    Database Keys




   Example relationship using a primary key
    and a foreign key
             Entity Relationships
   A relationship is a link or association between entities.
       Normally one dentist has many patients
   There are three types of relationships:
       One – to – One
            A car has one engine size
       One – to – Many
            A landlord has many houses
       Many – to – Many
            A chocolate bas has many ingredients BUT An ingredient can be used in
             many different chocolate bars
   Due to database rules however we only use One – to – many
    when designing databases.
       One – to – One relationships are pointless and attributes get collapsed
        into one entity,
       Many – to – Many relationships cant exist as the data cant be linked
        properly and makes no sense which instance relates to which
         Entity Relationships Diagrams
   This is a way of showing relationships between entities,
   Entity names are always written in capitals and appear in
    rectangles,
   Lines join entities together and have:
       Symbol to show the degree of the relationship,
       A description to show the name of the relationship,
Entity Relationships Diagrams

           drives
EMPLOYEE              COMPANY CAR

           holds
  WARD                  PATIENT

           features
  ALBUM                SINGERS
       Many – To – Many Resolve
   Many - to – Many relationships are not allowed so
    we have to resolve them some how.
              ALBUM                                     SINGER

   To do this we introduce an additional entity between
    them
   Thus creating 2 one - to – many relationships.
                                         SINGER

                                                  features

               ALBUM                 ALBUM / SINGER

                       complied of
         Exercises
1)   Make a brief description (1/2 page) about the role of the
     DBMS
2)   Write down 3 examples along with a description of uses a
     company could have for a database
3)   Draw an entity relationship diagram to show the
     relationship between
        Product and Component
        House and Street
        Pet Owner and Pet
4)   Draw an entity relationship diagram providing a many – to
     – many resolve to show the relationship between
        Customer and Video in a rental shop
        Student and Course in a school
        Patients and Medicine in a hospital

				
DOCUMENT INFO
Shared By:
Categories:
Stats:
views:15
posted:6/17/2011
language:English
pages:13