N5 Databases Notes Information Systems Design & Development: Structures and links.

Slides:



Advertisements
Similar presentations
Organisation Of Data (1) Database Theory
Advertisements

DATABASE RC D DD CMA C M R B PK E I S H S RC H L I V FK.
WHAT D IS RAW, UNPROCESSED FACTS AND FIGURES COLLECTED, STORED AND PROCESSED BY COMPUTERS.
XP Chapter 3 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Analyzing Data For Effective Decision Making.
With Microsoft ® Access 2010© 2011 Pearson Education, Inc. Publishing as Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Access.
Databases Week 7 LBSC 690 Information Technology.
1 Chapter 2 Reviewing Tables and Queries. 2 Chapter Objectives Identify the steps required to develop an Access application Specify the characteristics.
Software Development Unit 2 Databases What is a database? A collection of data organised in a manner that allows access, retrieval and use of that data.
With Microsoft Office 2007 Introductory© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Office 2007 Introductory.
DAY 14: ACCESS CHAPTER 1 Tazin Afrin October 03,
Databases & Database Driven Websites Notes
 A database is a collection of data that is organized so that its contents can easily be accessed, managed, and updated. What is Database?
Analyzing Data For Effective Decision Making Chapter 3.
1 By: Nour Hilal. Microsoft Access is a database software where data is stored in one or more Tables. A Database is a group of related Tables. Access.
Discovering Computers Fundamentals Fifth Edition Chapter 9 Database Management.
Microsoft Access Designing and creating tables and populating data.
WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING.
Microsoft Office XP Illustrated Introductory, Enhanced Tables and Queries Using.
Relational Databases. Relational database  data stored in tables  must put data into the correct tables  define relationship between tables  primary.
You can sort Access data so you can view records in the order you want to view them, and you can filter data so you only see the records you want to see.
Verification & Validation. Batch processing In a batch processing system, documents such as sales orders are collected into batches of typically 50 documents.
Relational Database Techniques
Lesson 13 Databases Unit 2—Using the Computer. Computer Concepts BASICS - 22 Objectives Define the purpose and function of database software. Identify.
Databases Competency Explain advanced database concepts and functions.
Description and exemplification use of a Data Dictionary. A data dictionary is a catalogue of all data items in a system. The data dictionary stores details.
Software. Because databases can get very big, it is important to decide exactly what is going to be stored in each field. Fields can be text, number,
Access Queries and Forms. Adding a New Field  To insert a field after you have saved your table, open Access, and open the table  It is easier to add.
VOCAB REVIEW. A field that can be computed from other fields Calculated field Click for the answer Next Question.
Database (Microsoft Access). Database A database is an organized collection of related data about a specific topic or purpose. Examples of databases include:
To play, start slide show and click on circle Access 1 Access 2 Access 3 Access 4 Access Access
Emdeon Office Batch Management Services This document provides detailed information on Batch Import Services and other Batch features.
1 Finding Your Way Through a Database Exploring Microsoft Office Access.
DATA TYPES.
Fundamentals of DBMS Notes-1.
Creating a database table
Prepared By: Bobby Wan Microsoft Access Prepared By: Bobby Wan
Databases Chapter 9 Asfia Rahman.
Database Design & Development
Databases.
GO! with Microsoft Office 2016
Tutorial 5: Working with Excel Tables, PivotTables, and PivotCharts
Microsoft Office Access 2010 Lab 2
Practical Office 2007 Chapter 10
Microsoft Access – Tutorial 3
Data and Information.
LIS 384K.11 Database-Management Principles and Applications
Unit 16 – Database Systems
Data Validation and Protecting Workbook
Types of data This presentation differentiates between ICT professional and end users.
GO! with Microsoft Access 2016
Database Design and Development
Data Types and Field Properties
Access Busn 216.
GO! with Microsoft® Access e
Tutorial 3 – Querying a Database
Chapter 9 Database and Information Management.
Databases Software This icon indicates the slide contains activities created in Flash. These activities are not editable. For more detailed instructions,
Data Types and Field Properties
Data Types and Field Properties
Database Theory.
Spreadsheets, Modelling & Databases
The ultimate in data organization
Microsoft Office Access is the best –selling personal computer database management system. What is Access?
Data Types and Field Properties
Data Types and Field Properties
Shelly Cashman: Microsoft Access 2016
Presentation transcript:

N5 Databases Notes Information Systems Design & Development: Structures and links

Contents Flat File vs Linked Tables & Keys ◦ Questions Questions Splitting Database Tables ◦ Questions Questions Data Types & Validation ◦ Questions Questions Database Operations ◦ Questions Questions

Flat File Databases Flat file databases contain a single table of data Each single item of information is a field. In this flat file database, the columns are all the different values stored for that field The collection of all the different fields about one item, person or object is a record In this flat file database, the rows are all individual records The collection of all information in the database table is known as the file

Flat File Databases There are disadvantages to using flat file databases: Flat file databases can have data duplication – the same items of data can reappear across multiple rows Data duplication is inefficient in terms of data storage. It can also result in modification errors – where a change is made to some but not all of the duplicated data

Linked Tables Flat file databases should be split into linked tables to prevent the problems caused by data duplication Because information is stored in different tables, there is no longer any data duplication. This also removes the risk of modification errors

Linked Tables Key fields are used to link tables together In the example below, the Movie ID and Star ID fields appear in different tables. This allows different tables to be linked together. The information in the different tables can then be joined together

Key Field The primary key field in a table is a unique identifier for records in that table. Every table must have a primary key. The primary key can contain no duplicate values A foreign key is a field in a table that uniquely identifies a record in a different table Not every table requires a foreign key. The foreign key field in a table is usually the primary key field in the related table

Questions – Flat Files vs Linked Tables & Keys Answer questions in full sentences! 1. Describe the difference between flat file database structures and linked tables database structures 2. What is data duplication? Explain how it is inefficient 3. What is a modification error? 4. How do linked tables prevent data duplication? 5. What is a primary key? 6. Explain why the value in a primary key field has to be unique 7. What is a foreign key? 8. Why is the foreign key field in a table often the primary key of a different table?

Splitting Tables Take the following steps to split up tables with data duplication ◦ Identify columns with duplicated data ◦ Split into two tables, one for duplicated columns, one for others ◦ Identify primary keys ◦ Add primary key from table with duplicated columns to other table as foreign key Dept Dept ID Dept Name Manager Product Product Code Product Type Product Name Dept ID * 1 8

Identify Columns With Duplicated Data The Dept ID, Dept Name and Department Manager columns all show duplicated values Make sure that the same duplicates always occur in the same rows – Where Dept ID 4 is duplicated, it is always duplicated with the Toiletries Dept Name and H Green as the Department Manager

Split Into Tables You will need to split the flat file table into two. One table should be contain the fields with duplicated values All other fields should be added to the other table Give the two new tables a meaningful name based on their contents Dept Dept ID Dept Name Manager Product Product Code Product Type Product Name

Identify Primary Keys You will need to identify a suitable primary key for both tables The primary key field should not contain duplicate values. Fields that are an ID number are usually used as primary key fields Mark the primary key field by underlining it or writing the letters PK next to it Remember, although we split the table based on duplicate values, the duplicate rows will be removed. This will allow us to select a primary key field for the table that contained duplicated values Dept Dept ID Dept Name Manager Product Product Code Product Type Product Name

Add a Foreign Key The final step is to link the tables by adding a foreign key The primary key from the table that contained the duplicated values should be added to the other table Mark it with a * or the letters FK to indicate it is the foreign key Dept Dept ID Dept Name Manager Product Product Code Product Type Product Name Dept ID * 1 8

Questions – Splitting Tables Split the following flat file tables into two linked tables. Identify primary and foreign keys 1. 2.

Fields & Data Types A field is a single element of information about one thing When designing a database, fields have a number of properties to describe how the information will be stored. The data type of a field describes what sort of information it will store. This affects how the information is encoded in binary on the computer Database data types include:  Text  Numbers  Date & time  Calculated fields  Graphics  Hyperlinks  Boolean Different database will describe these type differently

Data Types Text: Text fields store letters, numeric characters and symbols. ASCII or Unicode is used for storing text Numbers: Number fields store numeric values using binary Date & Time: Date and time fields are a special kind of number field. Multiple numbers are stored in binary to represent the component parts of a date and / or time such as year, month, day, hours, minutes and seconds Calculated: A calculated field’s value is not stored. Instead it is worked out using a formula and values in other fields. This saves storage space and can prevent update errors. Age is a good example of a calculated field as using a calculated field will automatically update age every birthday

Data Types Graphics: Graphics fields are used to store pictures. Different graphics formats such as GIF or JPG may be used depending on the database Hyperlink: A hyperlink field is a special type of text field. In addition to storing text, the database will allow users to click on the hyperlink and open that URL in a browser window Boolean: Boolean fields can only contain one of two possible values. These are usually either true or false. Some databases use yes or no instead. It is possible to store a Boolean field in a single bit.

Validation Validation is when a database forces the user to enter data that meets a certain set of rules. If the data does not meet the rules – is invalid – the database rejects it There are a number of different types of validation check:  Presence check – ensures something has been entered  Unique check – ensures the value entered is different from every other instance of the field in the table.  Length check – restricts the number of characters that can be entered  Range check – ensures the value entered falls within a numerical range  Restricted choice – give the users a limited set of choices to pick from to prevent errors. Commonly used with look up tables for foreign keys

Questions – Data Types & Validation Answer questions in full sentences! 1. What is meant by the data type of a field? 2. Why do fields need to have a data type? 3. Describe in detail the information stored and how it is stored for four field types 4. Choose a suitable type or types of validation check to apply to the following fields. Explain your decision: a.A field containing test marks out of 20 b.A field containing mobile phone numbers – hint: mobile phone numbers contain 11 digits c.A field containing which house – Edinburgh, Fyvie or Cragievar – that a pupil belongs to d.The primary key field of a database e.A postcode field, where the field cannot be left blank

Database Operations Two operations to query the data in a database can be carried out – searching and sorting A simple search finds all the records in a database that match a criterion set on one field Comparison operators such as =, > and < are used to match the value in a given field for each record. For example: Cost < 0.10Matches all records where the value in the field Cost is less than 10 Name = “Alice”Matches all records where the value in the name field is Alice Name = “B*”Matches all records where the value in the name field begins with the letter B

Complex search A complex search allows several search criteria to included in a single search. The logical operators AND and OR are used to connect conditions together ANDThe values in the fields must match both conditions in order for the record to be found by the search ORThe values in the field only need to match one condition for the record to be found by the search Mark >=60 AND Mark <70Finds all test marks between 60 (inclusive) and 70 – all the B grades Grade = “A” OR Grade=“B”Finds grades that are either A or B. It finds both As and Bs.

A database sort puts the records, or results of a search, into order. A field can be specified as the basis for sorting. The sort can either be ascending (lowest value first) or descending (highest value first). For example: Sort by Name in ascending order The records will be displayed ordered by the Name field, starting at A and ending at Z. A secondary sort field can be specified. When the values in the primary sort field are the same, the secondary field will be used to differentiate between the records Searches and Sorts can be created in SQL. Structured Query Language is a scripting language that can be used to manipulate the information in databases

Identifying a sort You may be asked to identify how a database has been sorted. This will always be a sort on two or more fields The steps to identify a sort are: ◦ Identify the primary field for the sort – This should be the only field that the values go completely in order through the entire column. ◦ State if the primary field is sorted in ascending or descending order ◦ Identify groups of rows in the primary sorting field that have the same value ◦ Check each other column for evidence of sorting – only look at the rows with the same value in the primary sort field ◦ State the secondary sort field and if it is sorted in ascending or descending order

Identifying a sort Date is the only column that is in order for all the rows It is the primary sort field, in ascending order These are the groups of rows with the same value for date We have to check each group to see what order it is in So this database is sorted into date ascending order, then time ascending order

Questions – Database Operations Answer questions in full sentences! 1. Explain the difference between a simple and a complex search 2. Explain the difference between the AND and OR logical operators 3. Describe what each of the following complex searches will find: a.Year Group = 4 AND House = Edinburgh b.Favourite Subject = “Computing” OR Favourite Subject = “Maths” c.Gender = “M” AND Age >=12 AND Age <= Explain when the secondary sort field will be used during a sort 5. Identify how the following table has been sorted: