Data Modelling: 1 Entity, Keys & Attributes

Similar documents
A Flat file database. Problems with a flat file database (data redundancy)

IT2.weebly.com Applied ICT 9713

Database Concepts Using Microsoft Access

«Information and communication technologies» Practical work 5. Databases

Discovering Computers Fundamentals, 2011 Edition. Living in a Digital World

European Computer Driving Licence

Level 6 Relational Database Unit 3 Relational Database Development Environment National Council for Vocational Awards C30147 RELATIONAL DATABASE

Chapter 10 Managing a Database. Discovering Computers Your Interactive Guide to the Digital World

Objectives Overview. Chapter 10 Managing a Database. Discovering Computers Instructor: M. Imran Khalil MSc-IT 1 st semester Fall 2016

Chapter 10 Managing a Database. Discovering Computers Your Interactive Guide to the Digital World

Operate a Database Application

Topic 2 Data and Information. Data Data can be defined as a set of recorded facts, numbers or events that have no meaning.

INFORMATION TECHNOLOGY NOTES

COMP3 (JUN13COMP301) General Certificate of Education Advanced Level Examination June 2013

We move from a general information system to a Computer Based Information System

Database Technologies. Madalina CROITORU IUT Montpellier

Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition. Chapter 7 Data Modeling with Entity Relationship Diagrams

DATA Data and information are used in our daily life. Each type of data has its own importance that contribute toward useful information.

Author: Tore Olsson, Education Outreach Coordinator Revision December 12, 2016 STEP 1 - SIGNING UP

THIS IS A NEW SPECIFICATION

INFS 328 Systems Analysis and Design

Discovering Computers Chapter 10 Database Management

DBMS Questions for IBPS Bank Exam

DATA TYPES. Numeric Data

Chapter 11 Database Concepts

9.Introduction to Database Management System

GCE A level 1103/01 COMPUTING CG3

Level 2 Data management software (DMS )

SAMPLE FINAL EXAM SPRING/2H SESSION 2017

Official Statistics - Relational Database Management Systems. Official Statistics - Relational Database Management Systems

IMPLEMENTING LOGICAL DATA TYPES

Introductory Exercises in Microsoft Access XP

CPSC 211, Sections : Data Structures and Implementations, Honors Final Exam May 4, 2001

Associates System. User Guide Staff with Service Desk Role Information Technology and Communication Services Author: Lee Spargo

National 5 Administration and IT

MRIEHEL SECONDARY SCHOOL HALF-YEARLY EXAMINATIONS 2016~17. Year 9 Computing Time: 1hr 30mins

FACTFILE: GCE DIGITAL TECHNOLOGY

Data and Process Modeling

Introduction. Other titles in the series include: GCSE ICT Theory Pack 2 GCSE ICT Practical Course Pack 1. Steve McWeeney September 2006

National 5 Administration and IT


By: Access 2007 Table

Level 2 Combining word processing, spreadsheet and database applications to present information (7266/ )

MARKING GUIDELINE -1- NC1710(E)(O29)V OFFICE DATA PROCESSING MARKING GUIDELINE NATIONAL CERTIFICATE (VOCATIONAL) NOVEMBER 2009

Bangladesh Open University

Database Systems. Overview - important points. Lecture 5. Some introductory information ERD diagrams Normalization Other stuff 08/03/2015

Chapter 4. In this chapter, you will learn:

Designing a Database -- Understanding Relational Design

Level 3 Designing and creating relational databases (7266/ ) e-quals

2 New Company Setup OBJECTIVES:

Creating SQL Tables and using Data Types

PAF Code of Practice

Software Engineering Prof.N.L.Sarda IIT Bombay. Lecture-11 Data Modelling- ER diagrams, Mapping to relational model (Part -II)

Database Systems. A Practical Approach to Design, Implementation, and Management. Database Systems. Thomas Connolly Carolyn Begg

Entity-Relationship Modelling. Entities Attributes Relationships Mapping Cardinality Keys Reduction of an E-R Diagram to Tables

Detailed Data Modelling: Attribute Collection and Normalisation of Data

Exam code: Exam name: Database Fundamentals. Version 16.0

Introduction to EVOLVE for Staff

Northern New York Library Network. Jim Crowley. Course objectives. Course description. Schedule. Workshop

Conceptual Data Models for Database Design

Microsoft Access 2007 Module 1

MRIEHEL SECONDARY SCHOOL HALF-YEARLY EXAMINATIONS 2016~17. Year 9 Computing Time: 1hr 30mins MARKING SCHEME. a) CPU : b) MSB : c) GUI :

FEED IN TARIFF APPLICATION FORM

Database. Ed Milne. Theme An introduction to databases Using the Base component of LibreOffice

Database Systems CSE Comprehensive Exam Spring 2005

SQL Functionality SQL. Creating Relation Schemas. Creating Relation Schemas

Lecture 5 STRUCTURED ANALYSIS. PB007 So(ware Engineering I Faculty of Informa:cs, Masaryk University Fall Bühnová, Sochor, Ráček

Teach Yourself Microsoft Office Excel Topic 11: Mail Merge

K Hinds Page 1. Information Communication Technology Microsoft Access

Chapter 2 Conceptual Modeling. Objectives

A451. COMPUTING Computer Systems and Programming GENERAL CERTIFICATE OF SECONDARY EDUCATION. Monday 23 May 2011 Morning

ICT IGCSE Databases (Access) A database is a collection of data or information stored in a logical format.

ECE 122. Engineering Problem Solving Using Java

London Examinations IGCSE

The specific steps to build Wooden Crafts database are here: 1. Create New Database. i. After opening Access, click Blank Desktop Database :

The DBMS accepts requests for data from the application program and instructs the operating system to transfer the appropriate data.

COMP Instructor: Dimitris Papadias WWW page:

Lesson 1. Exploring QuickBooks INTRODUCTION OBJECTIVES

CONTENTS INTRODUCTION... 1 DATABASE CONCEPTS... 3

Release Date: September, 2015 Updates:

Programming Logic and Design Sixth Edition

Introduction to Databases

Copyright 2009 Labyrinth Learning Not for Sale or Classroom Use LESSON 1. Designing a Relational Database

Unit 10 Databases. Computer Concepts Unit Contents. 10 Operational and Analytical Databases. 10 Section A: Database Basics

Data Information Database Database System Data 1. Known facts that can be recorded and have an implicit meaning.

download instant at The Relational Data Model

Getting Information from a Table

Answer any Five Questions. All questions carry equal marks.

You can write a command to retrieve specified columns and all rows from a table, as illustrated

Access 2000 MICROSOFT. Level One Basic. Version N2

Data Analysis 1. Chapter 2.1 V3.1. Napier University Dr Gordon Russell

Figure 1 - The password is 'Smith'

1 Introduction to Excel Databases April 09

Policy for College Staff Relating to Electronic Records, File/Document Management

WorkflowMax & Xero Month-end Process

Entity Relationship Modelling

IMPORTANT INFORMATION:

COMP2 (JAN10COMP201) General Certificate of Education Advanced Subsidiary Examination January 2010

Level 2 Database software ( )

Introduction to EVOLVE for Staff

Transcription:

Data Modelling: 1 Entity, Keys & Attributes Introduction Data (information) has become as precious a commodity to the organisation as the product they sell. The data and information accumulated by a company represents one of its most valuable assets. In order to gain the maximum benefit from it, the data must be carefully organised so that it can be used in the most effective way possible. The Analyst must have a good understanding of storing data (data modelling) so that the organisation gets the best use from it. This often means maintaining a database. Ql: Identify some of the ways in which access to information can be vital to the success of a supermarket chain such as Tesco's, Asda or Sainsbury's. What is a database? At its very simplest level, a database may be simply a computerised 'card-index' system to help you keep labs on a collection of CDs or the names, addresses and telephone numbers of your friends. More complex databases may store data about customers, stock levels, suppliers, employees, etc., etc. A database consists of a pool of data and software to organise it and control access to it, known as the Database Management System (DBMS). The database software will allow you to input and edit data, view or print data, and make simple queries to find, for example, the names of all people living in Sutton. There may be more than one file in your database; in a database about Films, you could hold separate files (one for films and one for Actors). Database tables The fundamental structure in all databases is the table. Each table in a database contains information about an entity such as FILM, ACTOR, CD, SONG, CUSTOMER, ORDER, etc. DataMod1-Entity 1

Each row in the table contains information about a particular person or thing, i.e. about a particular occurrence of the entity such as Pulp Fiction, JFK or Mute Witness. Each column in the table contains information relating to a particular attribute such as title, year, and director. FILM Film Code Title Year Director 1234 Pulp Fiction 2001 Quinton Tarrentino 6435 JFK 1991 Oliver Stone 3498 Mute Witness 1995 Anthony Waller............ Q2: A library has a database to keep track of book loans and returns. One entity in the database is BOOK. Name 8 attributes of BOOK. Q3: Identify another entity in a library database, and name 8 attributes. Note that when you are holding information about people, it is almost always necessary to consider surname, initials and title as separate attributes, especially if the application requires you to send letters out. Above the 'greeting' you would need to put the customers title, initials and surname; e.g. Mrs P. M. Jamieson. But in the 'greeting' line, you need to put only the title and surname; e.g. 'Dear Mrs Jamieson'. If you address some of your customers by their first names or nicknames, you can add this flexibility by including an attribute called, for example 'Known As', which for Mrs Jamieson would contain 'Mrs Jamieson', but for your best friend Mr W. H. Golding would contain 'Bill'. Q4: Is Address a suitable attribute to hold for the entity CUSTOMER? If not, explain why, and state what attributes you would define to hold this information, DataMod1-Entity 2

Primary key Each individual row or record in a database table needs to be given a unique identifier, which is termed the primary key. The primary key, as you will see later, is the means by which data in different tables can be related or linked in a relational database. Sometimes the primary key consists of more than one field; for example, in a customer database, the key of the Customer table could consist of surname and telephone number, to guard against the possibility of two customers having the same surname. Q5: But this is not a sensible choice of key! Why? In general, it is a good idea to create an attribute for each entity, which will act as the primary key. Sometimes there is an obvious candidate: for example Order Number would be an ideal primary key on an ORDER table. Other times, a new attribute such as Customer Number, Student ID, Book Number can be created. It is NOT a good idea to use, for example, a person's surname as a primary key because it may not be unique it may change if the person gets married, and for reasons which will later become clear you should NEVER alter the primary key data it may be lengthy and therefore there is more chance of typing it incorrectly an index of key fields is automatically created by the database software and the shorter the key field, the less space occupied by the index, and the faster sorting and searching operations will be performed. Q6: An educational publisher has a table in its database, which holds details of schools and colleges likely to be interested in its publications. The entity is named COLLEGE. Name 5 attributes and state which of them you would use as the primary key. DataMod1-Entity 3

Standard Notation There is a standard notation, which is used to describe the structure of a table in a database. Using this notation: The ENTITY is written outside the brackets using CAPITAL LETTERS. An entity should be given a one-word, singular name; e.g. FILM and not FILMS. The primary key is underlined. The attributes are not written in capital letters, and may have names consisting of more than one word, such as Film Code. Example: FILM (Film Code. Title, Year, Director) Q7: Use standard notation to represent a BOOK table, CUSTOMER table and COLLEGE table. Exercise 1 A hospital keeps data on the patients, staff and wards. (a) Identify three entities in the database, and three or more attributes for each entity. (6 marks) (b) Write the table definitions using standard notation, identifying the primary key of each table. (6 marks) DataMod1-Entity 4

Attributes (properties and data type) Each attribute in a database table will have its own set of properties, which you have to decide upon when you first define the table structure. Designing the table structure is a bit like designing a filing cabinet or a carpenter's toolbox; you decide how many drawers it will have and how big they will be, bearing in mind what you intend to store in it later. For each attribute you must decide, in addition to its name: what data type will it be - an integer, a currency value with 2 decimals, a text string, a date, a Yes/No field or any other type allowed by the particular software you are using? if it is a text field, the maximum number of characters that the field will be able to hold any default value; for example, would it be convenient for a date field to default to today's date if the user just tabs over it when inputting data? any validation that should be applied to the field; for example, a month number must be between 1 and12, so the user should not be allowed to enter 21 by mistake. any format that should be applied to the field; for example, an ID number might always be two letters followed by 3 numbers whether the field is required, or can be skipped in some cases if it is not known. Once you have defined and saved a table's structure, you can begin putting data into the table. Choosing data types Numbers or text Supposing you are creating the table structure for the FILM database, where each film is identified by a 4-digit key. What field type should you specify: integer, real or text? Although you could choose integer, as a general rule unless you will be performing calculations with a particular field (for example adding its value to a total) it is a good idea to make it a text field. That way, a film code of 0003 will be displayed as 0003, and not lose its leading zeros, to be displayed as simply, 3. The same applies to telephone numbers. If you want to be able to enter, for example, 01473 255885, (01473)255885 or 01473-255885, you must define the field as a text Field or it will not be accepted. DataMod1-Entity 5

Option To define a field which shows whether or not a customer has paid a subscription, you could either: use a text field of length 3, and insert 'Yes' or 'No' into it use a single character field and insert 'Y' or 'N' into it use a Boolean field which will only accept 'True' or 'False', (or the equivalent 1 and 0) The advantage of using a Boolean field here is that the entry is automatically validated since only one of two values can be entered, and it saves space in the database as the field only occupies one bit (binary digit, 0 or 1). Exercise 2 A database contains an entity CUSTOMER that has the following attributes: Customer ID, Surname, Initials, Title, KnownAs, Street, Town, County, Postcode, Telephone, CreditLimit, Dateoflastorder, invoice paid (Y/N), Notes. All new customers are initially given a credit limit of 200, which may be increased once they have established their credit-worthiness. The database software allows fields to be defined as text, integer, real, currency, date, boolean, memo. (A memo field can contain up to 32,000 characters of text). Complete the following table showing what field types and properties you would use for each field. CUSTOMER Field name Data Type Length Required (V/N) Default Validation CustomerID...... Surname...... Initials Title KnownAs Street Town County Postcode Telephone CreditLimit DateOfLastOrder Invoice paid (Y/N) Notes. (14 Marks) DataMod1-Entity 6