Relational Database Techniques

Slides:



Advertisements
Similar presentations
Benchmark Series Microsoft Access 2010 Level 1
Advertisements

Access Lesson 2 Creating a Database
Access - Project 1 l What Is a Database? –A Collection of Data –Organized in a manner to allow: »Access »Retrieval »Use of That Data.
Microsoft Office 2007 Access Chapter 2 Querying a Database.
XP Chapter 3 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Analyzing Data For Effective Decision Making.
Creating And Maintaining A Database. 2 Learn the guidelines for designing databases When designing a database, first try to think of all the fields of.
FIRST COURSE Access Tutorial 2 Building a Database and Defining Table Relationships.
1 Chapter 2 Reviewing Tables and Queries. 2 Chapter Objectives Identify the steps required to develop an Access application Specify the characteristics.
Concepts of Database Management Sixth Edition
Multi-Table Forms Access – Lesson 5.
Access Ch 5 Review.
Chapter 2 Querying a Database
Chapter 3 Maintaining a Database
Microsoft Access 2000 Creating Tables and Relationships.
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall 1 1. Chapter 2: Relational Databases and Multi-Table Queries Exploring Microsoft Office.
Introduction to Access By Mary Ann Chaney and Alicia Harkleroad.
With Microsoft Office 2007 Intermediate© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Office 2007 Intermediate.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. ACCESS 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 4 – Creating New.
With Microsoft Access 2007 Volume 1© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Access 2007 Volume 1 Chapter.
Chapter 2 Querying a Database MICROSOFT ACCESS 2010.
Access 2007 Database Application Managing Business Information Effectively BCIS 1 and 2.
XP New Perspectives on Microsoft Access 2002 Tutorial 51 Microsoft Access 2002 Tutorial 5 – Enhancing a Table’s Design, and Creating Advanced Queries and.
Copyright © 2008 Pearson Prentice Hall. All rights reserved.1 1 Committed to Shaping the Next Generation of IT Experts. Chapter 2: Relational Databases.
With Microsoft Office 2007 Introductory© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Office 2007 Introductory.
Working with a Database
Access 2000 Part 1 Introduction to Access Agenda Starting Access. Creating Tables. Working with Tables. Setting Field Properties.
Access Tutorial 2 Building a Database and Defining Table Relationships
® Microsoft Office 2013 Access Building a Database and Defining Table Relationships.
 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.
CHƯƠNG 3 Finding, Filtering, and Formatting Data.
Lesson 2.  To help ensure accurate data, rules that check entries against specified values can be applied to a field. A validation rule is applied to.
XP New Perspectives on Microsoft Access 2002 Tutorial 21 Microsoft Access Tutorial 2 – Creating And Maintaining A Database.
Microsoft Office 2007 Access Chapter 2 Querying a Database.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 2 1 Microsoft Office Access 2003 Tutorial 2 – Creating And Maintaining A.
® Microsoft Office 2010 Access Tutorial 3 Maintaining and Querying a Database.
® Microsoft Access 2010 Tutorial 2 Building a Database and Defining Table Relationships.
Chapter 17 Creating a Database.
® Microsoft Office 2010 Building a Database and Defining Table Relationships.
Microsoft Office 2007 Access Chapter 3 Maintaining a Database.
Microsoft Office Illustrated Introductory, Premium Edition Using Tables and Queries.
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.
Copyright 2007, Paradigm Publishing Inc. ACCESS 2007 Chapter 1 BACKNEXTEND 1-1 LINKS TO OBJECTIVES Create and Open a Database Create and Open a Database.
Microsoft Access 2010 Chapter 10 Administering a Database System.
XP Chapter 2 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Building The Database Chapter 2 “It is only the farmer.
A Skills Approach Access 2010 Working with Tables © 2012 The McGraw-Hill Companies, Inc. All rights reserved Chapter 2.
Microsoft Office XP Illustrated Introductory, Enhanced Tables and Queries Using.
Copyright 2007, Paradigm Publishing Inc. ACCESS 2007 Chapter 3 BACKNEXTEND 3-1 LINKS TO OBJECTIVES Modify a Table – Add, Delete, Move Fields Modify a Table.
Microsoft Access. Microsoft access is a database programs that allows you to store retrieve, analyze and print information. Companies use databases for.
1 11 Exploring Microsoft Office Access 2007 Chapter 6 Data Protection.
Lesson 4.  After a table has been created, you may need to modify it. You can make many changes to a table—or other database object—using its property.
Work with Tables and Database Records Lesson 3. NAVIGATING AMONG RECORDS Access users who prefer using the keyboard to navigate records can press keys.
Pasewark & Pasewark 1 Access Lesson 2 Creating a Database Microsoft Office 2007: Introductory.
Excel part 5 Working with Excel Tables, PivotTables, and PivotCharts.
MSOffice Access Microsoft® Office 2010: Illustrated Introductory 1 Part 1 ® Database & Table.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 5 1 Microsoft Office Access 2003 Tutorial 5 – Enhancing a Table’s Design.
Microsoft Access Prepared by the Academic Faculty Members of IT.
Creating Advanced Queries and Enhancing Table Design.
Getting Started in Access 1 Using an existing Database Database Window Table Design View Parts of a Table Views in Access Navigating in Access Entering.
VOCAB REVIEW. A field that can be computed from other fields Calculated field Click for the answer Next Question.
Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall. 1 Skills for Success with Microsoft ® Office 2007 PowerPoint Lecture to Accompany.
COMPUTER SKILLS MS-ACCESS. Introduction Access is a piece of software known as a database management system. At its most basic level, it can be used to.
MICROSFTACCESS tables. DATA TYPES Field TypeWhat It Holds Short Text Text up to 255 characters long (including spaces and punctuation). Use a Text field,
Practical Office 2007 Chapter 10
Access Chapter 2 Querying a Database.
MODULE 7 Microsoft Access 2010
Access Lesson 2 Creating a Database
Guidelines for Microsoft® Office 2013
Presentation transcript:

Relational Database Techniques Chapter 10

Developing A Database Schema A database schema is a description of the data and the organization of the data into tables in a relational database. 3 step approach Determine which information to include in the database. Consider the purpose of the database. Divide information into related groups to create tables and then give each table a descriptive name. Describe the fields and determine the primary key for each table.

Creating A Database Field Name: Within a table, fields store data. A field has a name and a data type. Field Name: A field has a name to describe the data it stores. Consider the following guidelines when choosing field names: Make field names unique Choose the shortest possible name that accurately describes the contents of the field Use complete words instead of numbers or abbreviations Avoid special characters A well-designed database has fields that store only one piece of data for each entry.

Creating A Database Cont’d Field Type: Fields are classified by type of data they store AutoNumber fields Automatically store a numeric value that is one greater than that in the last record added Text fields Store characters (letters, symbols, words, a combination of letters and numbers) and numbers that do not require calculations, such as telephone numbers and ZIP codes Number fields Store only numeric values Date/Time fields Store dates or times Currency fields Store dollar amounts Memo fields Store several lines of text

Creating A Database Cont’d Field Type: Yes/No fields Hyperlink fields Appear as a check box that is/are either selected or left cleared to represent yes/no, true/false, or on/off Hyperlink fields Store links to files, e-mail addresses, and Web site addresses Attachment fields Store files that are attached and can be opened directly from the field and edited in its native application Lookup fields Store data retrieved from a field in another table They define a relationship between tables.

Creating A Database Field Size Cont’d The size of a field is the number of characters or the type of number it can store. Text fields can store up to 255 characters Number fields are defined by the type of value it stores Fields with decimal numbers – field size is Single Fields with only whole numbers – field size is Long Integer Fields sizes cannot be defined for date/time, currency, and hyperlink fields

Creating A Database Field Format Cont’d Numeric and date/time fields can have a specified format to define how to data is displayed. Text memo and hyperlink fields usually have no format Numeric field formats include: General Number – default; displays a number as typed Fixed – displays a value to a specified number of decimal places Percent – multiplies the value entered by 100 and displays it with a percent (%) sign Standard – displays the value with a thousands separator, usually a comma

Creating A Database Field Format Cont’d Date/Time field formats include: Long (i.e. Saturday, June 24, 2011 or 10:12:30 AM) Medium (i.e. 24-June-11 or 10:12 AM) Short (i.e. 6/24/11 or 10:12) Decimal places can be set for numeric field types

The Primary Key To ensure that no two records in a table are the same, one field in each table is designated the primary key The primary key column cannot contain duplicate entries. Social Security Number Product ID Serial Number The primary key may also be a combination of fields designated to have a unique combination of entries

Guided Practice Align Sales – Part 1 of 3

Creating Tables and Fields Design View To control all aspects of a table, complete it in Design View Click Home → View → Design View to switch to Design View To create a new table in Design View: Click Create → Table Design Create fields for the table by adding one field per row

Creating Tables and Fields Cont’d Creating Tables and Fields To define a field name: Type the field name in the first empty Field Name box. Select the field type from the Data Type box. For a lookup field, select Lookup Wizard to display a series of dialog boxes for defining the data source. Type a description of the field data in the Description box. Type or select the field size in the Field Size box in the General tab at the bottom of the Design view window. For a text field, the size is the greatest number of characters allowed. For a number field, select either Long Integer or Single. Date/Time and Currency fields do not have a field size. Select a field format in the Format box of the General tab. Text and memo fields do no have a format. Type the number of decimal places for numeric data in the Decimal Places box of the General tab.

Creating Tables and Fields Cont’d Creating Tables and Fields To designate a primary key: The primary key field requires an entry to ensure that each record is unique. Click the Required option on the General tab and then select Yes. If the combination of data in two fields is required to make every record in a table unique, then designate both fields together as the primary key Click the gray box to the left of the first field, hold down the CTRL key, and then click the gray box to the left of the second field and then click: Design → Primary Key

Guided Practice Align Sales – Part 2 of 3

Creating Forms Create → Form, Create → More Forms → Split Form, or Many different kinds of forms can be created and each can be customized. A simple form displays a datasheet along with entry boxes when its table is related to one other table only. There can be numerous forms for a table, providing many options for entering and viewing data for a single table. To create a new form, select a table object from the Navigation Pane, and then click Create → Form, Create → More Forms → Split Form, or Create → More Forms → Multiple Items A new form based on the selected table is displayed in Layout View where it can be formatted.

Creating Forms Cont’d Layout View Layout → Remove Layout Click an entry box and then drag its borders to change the size of all the entry boxes Drag the right border of a datasheet to reduce or increase the extra space after the last field Drag the datasheet control to move the datasheet To individually size field names and entry boxes, they must be separated from the group. Once separated, field names and entry boxes can also be moved individually To break apart a group, click the four headed arrow control button from the group and then right-click a field name or entry box and select Layout → Remove Layout

Creating Forms Cont’d Form View Design → View → Form View When formatting is complete, click: Design → View → Form View Form view is where records are entered As a reminder of what kind of data a field stores, the status bar at the bottom of the Access window displays the description o the selected field. The field description is the text that was typed in the Description box for the field in Design View.

Guided Practice Align Sales – Part 3 of 3

Restricting Data Entry To help ensure accurate data, validation rules that check entries against specified rules can be applied to a field. A validation rule is applied to a field in Design view Once a validation rule is applied, field entries are restricted to values that adhere to the rule. If an entry breaks the rule, it is cleared from the entry box and the validation text is displayed in a dialog box Validation rules for numeric entries are often formed with one or more relational operator: Less than < Greater than > Less than or equal to <= Greater than or equal to >= Not equal to <> If an entry does not make the validation rule true, then an error dialog box is displayed.

Restricting Data Entry Cont’d Restricting Data Entry Validation rules can also contain logical operators, which form a compound expression. Logical operators include: And requires an entry to match both criteria Or requires an entry to match one criteria Not requires an entry not match the criteria For example: If the cost of an item must be more than 0, but less than 10, the validation rule >0 And <10 Will restrict entries to values between 0 and 10

Restricting Data Entry Cont’d Restricting Data Entry If the possible entries for a Text field can be limited to a set of values, then a validation rule should be applied to the field. When a validation rule is applied to a Text field, only the specified values will be allowed For example: For a color field that should contain only green, blue, or yellow, use the validation rule “green” Or “blue” Or “yellow”.

Restricting Data Entry Cont’d Restricting Data Entry Text and Date/Time field entries can be restricted by using an input mask. An input mask controls how data is entered and is useful when entries should follow a certain format. For example: An Employee ID field that requires an entry similar to 123-45, could use an input mask to show placeholder characters and a hyphen and require that five digits be entered.

Restricting Data Entry Cont’d Restricting Data Entry Access has several existing input masks already defined In Design View, select a field to receive a mask and then click the ellipses button in the Input Mask box in the General tab to start the Input Mask Wizard To use an existing mask, select the mask name and then click Next. To add a new input mask, select Edit List and then click New (blank) record. Type a name in the Description box, placeholders in the Input Mask box, a placeholder character in the Placeholder box, and an example in the Sample Data box

Restricting Data Entry Cont’d Restricting Data Entry Mask Characters Digits 0 and 9 are two commonly used placeholders, also called mask characters. 0 means that a digit must be typed for that place 9 means that a digit is optional Literal characters, such as a hyphen (-), are used along with the mask characters to force the entry to follow a certain format The underscore character (_) is a commonly used placeholder character

Milla Hardware – Part 1 of 8 Guided Practice Milla Hardware – Part 1 of 8

Table Relationships In a relational database, two tables are related when a field in one table corresponds to a field in another table. The related fields must have the same data type, but are not required to have the same name. To join and analyze data from multiple tables, table relationships must first be defined. To view relationships, click Database Tools → Relationships The Relationships window opens and the Design tab is added to the Ribbon.

Table Relationships Cont’d To create a relationship, add tables to the Relationship window and then drag a field from one table to a related field in another table. The Edit Relationships dialog box is displayed Verify the related fields in the dialog box and then select Create Lines indicate the relationships between tables

Table Relationships Foreign Key Cont’d The primary key in one table and the foreign key in another table are used to define a relationship. A foreign key is a field in a table that is a primary key in another table. Relationships formed this way are one-to-many which means that there is one and only one record in the primary key table that relates to zero, one, or more records in the related table.

Table Relationships Lookup Fields Cont’d A database with lookup fields will already have one or more relationships defined because Access automatically defines a relationship between the table containing the lookup field and the table containing the data used by the lookup field.

Table Relationships Deleting A Relationship Cont’d To delete a relationship, click the line that connects the two tables and then press the Delete key

Viewing Related Records Datasheet view includes subdatasheets of related records when relationships have been defined. A plus sign next to records in a datasheet indicate subdatasheets are available Click the plus sign to expand the Subdatasheet for a record A plus sign changes to a minus sign when a subdatasheet is displayed Click the minus sign to hide the subdatasheet

Milla Hardware – Part 2 of 8 Guided Practice Milla Hardware – Part 2 of 8

The Select Query A select query is a database object that is used to retrieve, or “select,” data that matches specified criteria. Can include any number of fields from related tables in a database Access uses the relationships to determine how to join the data from the selected tables The results are displayed in Datasheet View To create a select query: Create → Query Design The design grid is then used to specify fields and criteria After defining the select query, click: Design → Run to display the select query datasheet

Guided Practice Gadgets sales – Part 8 of 12

Modifying A Select Query Modifications to a query can include adding or removing fields, changing a sort order, or changing the order of fields in the design grid. Modified in Design View To switch a displayed query in Datasheet View to Design View: Home → View → Design View

Modifying A Select Query Cont’d Modifying A Select Query To add a field to the design grid, drag the field from the table in the Query window to the design grid If the field should appear between two existing fields, then place the insertion point in the column where the new field should appear and then click Design → Insert Columns A new column is added and existing columns are moved to the right If the Query window does not contain the table with the new field, click: Design → Show Table

Modifying A Select Query Cont’d Modifying A Select Query Delete a field from the query by deleting the appropriate column from the design grid. Place the insertion point in the column to be deleted and then click: Design → Delete Columns If after removing fields a table is no longer needed, then it should be deleted from the Query window. Click the table to select it and then press the Delete key

Guided Practice Gadgets sales – Part 9 of 12

Range Queries A select query with criteria that matches a range of values is called a range query. Range query criteria is specified using the relational operators When a range query compares text, alphabetical order is used to determine which data matches the criteria < > <= >= <>

Guided Practice Gadgets sales – Part 10 of 12

Complex Queries A select query with multiple criteria is called a complex query. Criteria is specified using the “And” and “Or” logical operators

Guided Practice Gadgets sales – Part 11 of 12

Using Wildcards in Query Criteria A wildcard is a character that matches any one or more characters. The asterisk (*) and the question mark (?) are two wildcards The * wildcard matches any number of characters or no characters at all Brush* matches Brush, Brushless, and Brush Tray The ? wildcard matches any one character or no characters at all Ann? matches Ann, Anne, Anna, but not Annette Wildcards can be used to specify select criteria When wildcards are needed, use the Like operator to specify criteria

Milla Hardware – Part 3 of 8 Guided Practice Milla Hardware – Part 3 of 8

Using Fields in Query Criteria A select query can specify another field in the criteria. A select query could be used to display products with a 200% markup (a 200% markup equals three times the cost). Use the format [Table Name]![Field Name] to refer to a field. If a field name is unique to the database, then the table name is not needed in the reference The table must be in the Query window

Milla Hardware – Part 4 of 8 Guided Practice Milla Hardware – Part 4 of 8

Parameter Query A parameter query retrieves data that matches criteria, called a parameter, typed by the user when the query is run. A parameter query can include any of the fields from related tables in a database A parameter query requires a prompt enclosed by brackets in the Criteria box. Running the parameter query displays a dialog box with the prompt Type a value and then select OK to complete the query

Milla Hardware – Part 5 of 8 Guided Practice Milla Hardware – Part 5 of 8

The Update Query An update query modifies, or updates, records Criteria can be specified to limit which records are updated If no criteria is specified, then all records containing the update field are modified To create an update query, create a select query in Design view and then click Design → Update To add the Update To row to the design grid After defining the update query, run the query to update the records A warning dialog box is displayed Select Yes to update the records An update query cannot be reversed after it is run

Guided Practice Gadget Sales – Part 12 of 12