DB Implementation: MS Access Tables

Slides:



Advertisements
Similar presentations
Designing Tables in Microsoft Access By Ed Lance.
Advertisements

Database Basics. What is Access? Database management system Computer-based equivalent of a manual database Makes it easy to organize and update information.
MS-Access XP Lesson 1. Introduction to MS-Access Database Management System Software (DBMS) Store data in databases Database is a collection of table.
Benchmark Series Microsoft Access 2010 Level 1
CVEV 118/698 Databases Lecture 2 Prof. Mounir Mabsout Elsa Sulukdjian Walid El Asmar.
COMPREHENSIVE Access Tutorial 2 Building a Database and Defining Table Relationships.
FIRST COURSE Access Tutorial 2 Building a Database and Defining Table Relationships.
With Microsoft Access 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Access.
1 Chapter 2 Reviewing Tables and Queries. 2 Chapter Objectives Identify the steps required to develop an Access application Specify the characteristics.
Tables. Any database must contain one or more tables, because that’s where the data is stored. For any table there are two views provided: Datasheet view.
S511 Session 6, IU-SLIS 1 DB Implementation: MS Access Tables.
Chapter 3 Maintaining a Database
Microsoft Access Tables Birgül Kutlu Bayraktar. TERMS A database is a collection of related information. An object is a competition in the database such.
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.
With Microsoft Office 2007 Intermediate© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Office 2007 Intermediate.
With Microsoft Access 2007 Volume 1© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Access 2007 Volume 1 Chapter.
Access 2000 Part 1 Introduction to Access Agenda Starting Access. Creating Tables. Working with Tables. Setting Field Properties.
Microsoft Access Intro Class 2 Designing Databases and Tables.
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?
Designing a Database (Part I) -Identify all fields needed to produce the required information -Group related fields into tables -Determine Each Table’s.
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.
WEEK 11 Database Design. TABLE INSTANCE CHARTS Create Tables.
1 Web-Enabled Decision Support Systems Access Tables: Building Data Foundation Prof. Name Position (123) University Name.
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 1-1 LINKS TO OBJECTIVES Design Tables and Fields Design Tables and Fields Data Types Field Size Property.
® Microsoft Access 2010 Tutorial 2 Building a Database and Defining Table Relationships.
Access Chapter 2: Relational Database Objectives Design data Create tables Understand table relationships Understand data types, key, & field properties.
® Microsoft Office 2010 Building a Database and Defining Table Relationships.
Microsoft Office 2007 Access Chapter 3 Maintaining a Database.
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.
Databases,Tables and Forms Access Text by Grauer Chapters 1 & 2.
A Skills Approach Access 2010 Working with Tables © 2012 The McGraw-Hill Companies, Inc. All rights reserved Chapter 2.
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 Office 2013: In Practice Chapter 2 Using Design View, Data Validation, and Relationships Copyright © 2014 by The McGraw-Hill Companies, Inc.
Relational Database Techniques
1 11 Exploring Microsoft Office Access 2007 Chapter 6 Data Protection.
Pasewark & Pasewark 1 Access Lesson 2 Creating a Database Microsoft Office 2007: Introductory.
Microsoft Office 2013 Try It! Chapter 4 Storing Data in Access.
Microsoft Access Prepared by the Academic Faculty Members of IT.
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.
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.
INTRODUCTION TO DATABASE USING MICROSOFT ACCESS 2013 Part 5.1 November 16, 2014.
MICROSFTACCESS tables. DATA TYPES Field TypeWhat It Holds Short Text Text up to 255 characters long (including spaces and punctuation). Use a Text field,
Copyright © 2014 Pearson Canada Inc. Ext. 5b-1 Copyright © 2014 Pearson Canada Inc. Application Extension 5b Using Microsoft Access Part 2: Using Information.
DB Implementation: MS Access Forms. MS Access Forms: Purpose Data entry, editing, & viewing data in Tables Forms are user-friendlier to end-users than.
To play, start slide show and click on circle Access 1 Access 2 Access 3 Access 4 Access Access
DB Implementation: MS Access Tables
Access Tutorial 2 Building a Database and Defining Table Relationships
Microsoft Access 2007 – Level 1
Practical Office 2007 Chapter 10
CREATING TABLES AND RELATIONSHIPS Section 2
Databases part 2 – field properties
DB Implementation: MS Access Forms
Creating a table in Access
MODULE 7 Microsoft Access 2010
Access Lesson 2 Creating a Database
DB Implementation: MS Access Forms
Data Types and Field Properties
Access Tutorial 2 Building a Database and Defining Table Relationships
Access Tutorial 2 Building a Database and Defining Table Relationships
ICT Database Lesson 2 Designing a Database.
Chapter 2 Design Table and Form.
Lecture 2 Lecturer: awdang aziz MS access
Chapter 2 Design Table and Form.
Presentation transcript:

DB Implementation: MS Access Tables Database Design

RDB Implementation: Overview Tables Translation of ER model in RDBMS construct For data storage entities, attributes, relationships Forms Data input/display user interface e.g. data entry form, search form For viewing, editing, entering, dynamic querying Queries Relational algebra operations combination of join, select, sort, filter, modify, etc. For data retrieval & manipulation Reports Data display output e.g. monthly reports (set query results) Forms can manipulate data, but reports cannot Database Design

RDB Implementation: Table Table is the fundamental element in a relational database. Contains data about a particular subject row = record = an entity (e.g., an employee, a product) column = field = an attribute (e.g., last name, product description) Users seldom see tables if at all. Data entry is usually done via forms. Main issues in table design What are the key attributes? i.e., primary & foreign keys What is the data type for each attribute? e.g. text, number, date, etc. What are the properties for each attribute? e.g. size, input/output format, range, etc. Database Design

MS Access Table: Data Types Text Alphanumeric data up to 255 characters. Memo Alphanumeric data with more than 255 characters Used for notes or comments: Cannot search or index on memo data type fields Number Numeric data for fields that need to have computational operations done AutoNumber Unique values created by Access for each new record (sequential number) → Cannot be changed once created Date/Time Dates and Time values for the years 100 through 9999. Currency Monetary values Yes/No Boolean (true/false, Yes/No, On/Off) → good for checkbox type field Hyperlink Links that opens a file or a Web address (e.g. URL, email address) Attachment Any supported files to attach (image, spreadsheet, document, chart, etc.) Lookup Wizard Tool to create lookup fields (i.e., dropdown list) Displays values derived from existing table/query or a manually specified list Calculated Field Results of a calculation (must be based on fields in the same table) MS Access 20010: Data Types & Field Properties Database Design

MS Access Table: Field Properties Field Size To set the maximum size for data type (e.g., Text, Number) Affects the stored value (via rounding, truncation) & DB size Format To customize the display/print layout of data Does not affect the stored value (e.g. Currency  $1,234.50) Input Mask To set the data input template to guide data entry e.g. Short Date  MM/DD/YYYY  99/99/0000;0;_ Validation Rule To validate/restrict data entry Use with Validation Text to display message on validation failure An expression that specify valid data values Database Design MS Access 2007: Field Properties Quick Reference

MS Access: Lookup Field Lookup Field/Column Displays a list of choices in a combo box or list box. The list is retrieved from another table/query or a value list. Creating a Lookup field via Lookup Wizard Select Lookup Wizard in Data Type column. The Lookup Wizard starts Select the Data Source in Lookup Wizard Look up the values in a table or a query, or Type in the values. For Table/Query-based lookup field, Choose a table/query Select fields (visible + data store) For Value List-based lookup field, Enter the number of columns to include in the lookup field. Type the values in the grid Choose the field whose value will be used List Box Combo Box Database Design MS Access 2007: Lookup Field

MS Access: Referential Integrity Necessary Conditions Matching field from “one” side of related tables Must be a primary key or have the Indexed property set to “Yes (No Duplicates)”. Related fields must have the same data type. exception: AutoNumber to Number when both have the same Field Size Effects Cannot enter a value in the foreign key field that does not exist in the primary key of the primary table Cannot delete a record in the primary table if matching records exists in the related table Cannot change a primary key value in the primary table if that record has related records. Cascading Updates/Deletes Allows automatic updates/deletes of all related records along with primary record e.g. change in primary key value in the primary table will be reflected in foreign key value of the related table Enabled/disabled in the relationships window Database Design

Table How-To: Overview Create a table. Table Design in Create tab Add fields to the table Data Type Field Properties Set the primary key Select the PK field Click the Primary Key icon (Design tab) Save & name the table Set the Relationships (Database Tools tab) Database Design

Table How-To: Creation Create a table in a new database Click the File tab, and then click New. In the File Name box, type a file name for the new database. To browse to a different location to save the database, click the folder icon. Click Create. A new database opens, and a new table named Table1 is created and opens in Datasheet View. 1.a 4.a 3.b 3.a 2 4.b 1.b Database Design

Table How-To: Creation Create a table in an existing database Click the File tab, and then click Open. In the Open dialog box, select the database that you want to open, and then click Open On the Create tab, in the Tables group, click Table Design A new table is inserted in the database and the table opens in Design view 1.a 1.b 2 3 Database Design

Table How-To: Fields Add a field to an existing table Open a table in Design View. Type a name for the field in the Field Name column. Select an appropriate data type in the adjacent Data Type column. Text, Memo, Number, Date/Time, Yes/No, etc. Set Field Properties. Field Size, Format, Input Mask, Validation Rule, etc. Lookup Wizard Field Properties Database Design

Table How-To: Primary Key Set a table's Primary Key Select the table whose primary key you want to set or change. On the Home tab, in the Views group, click View, and then click Design View. In the table design grid, select the field or fields that you want to use as the primary key. To select one field, click the row selector for the field that you want To select more than one field, hold down CTRL, and then click the row selector for each field On the Design tab, in the Tools group, click Primary Key. A key indicator appears to the left of the field or fields that you specify as the primary key To add an Autonumber primary key In the Field Name column of an empty row, type a name (e.g., CustomerID) In the Data Type column, click the drop-down arrow and click AutoNumber. 2.a 3 4 2.b Database Design

Table How-To: Relationships Click Relationships in the Database Tools tab. Click Show Table in the Design tab. Select tables and then click Add. When finished, click Close. Drag the Primary Key from one table to the Foreign Key in the other table. To drag multiple fields, press the CTRL key, click each field, and then drag them. Verify that the field names shown in the Edit Relationships dialog box are correct. If a field name is incorrect, click the field name and select a new field from the list. Select the Enforce Referential Integrity check box. Click Create. Database Design

MS Access Field Properties Field Size Format Input Mask Validation Rule Database Design

Field Property: Field Size Text Data Type 1 to 255 Number Data Type Determines the precision of the number that can be stored precision = number of significant digits Autonumber is 4 byte Setting Storage Value (Min, Max) Significant Digits Storage Size Byte (0, 255) N/A 1 byte Integer (-32,768, 32,767) 2 bytes Long Integer (–2,147,483,648, –2,147,483,647) 4 bytes Single (–3.4*1038, +3.4*1038)  7 Double (–1.797*10308, 1.797*10308)  15 8 bytes Decimal (-9.999*1027 , 9.999*1027) 28 12 bytes Database Design

Field Property: Text Format Symbol Description Example @ Required character (including space) (@@@@@): abc  ( abc) & Optional character (&&&&&): abc  (abc) < Force all characters to lowercase. <(@@@): ABC  (abc) > Force all characters to uppercase. >(@@@): abc  (ABC) [color] Display the field’s content in the named color >(@@@)[red]: abc  (ABC) \ Display next character as entered. &\M: abc  abcM “text” Display the text btw. quotes. &“ kg”: 16  16 kg * Fill all blank spaces with the next character. &*?: five  five???? (display length=8) ! Fill from left instead of right. !*?: five  ????five (display length=8) Determines how to display the contents of data in tables does not affect the stored value For enhancing readability e.g., credit card/phone number @@@-@@-@@@@: 123456789  123-45-6789 Syntax format for non-empty text; format for empty text e.g., @;”None”  display data as is, or ‘None’ when empty Database Design MS Access 2007: Format for Text & Memo Data Types

Field Property: Number Format Symbol Description Example Display a digit or 0. 00,000: 1234  01,234 # Display a digit or nothing. ##,###: 1234  1,234 % Multiply by 100 and append % sign ##.#%: 0.1234  12.3% Section Description First Format for positive numbers Second Format for negative numbers Third Format for zero values Fourth Format for Null values Pre-defined formats Currency e.g. displays ‘1234.567’ as ‘$1,234.56’ Percent e.g. displays ‘1234.567’ as ‘123456.70%’ (requires size = “double”) Scientific e.g. displays ‘1234.567’ as ‘1.23E+3’ Examples 0;(0);;”Null” display positive numbers normally, negative numbers in parenthesis, “Null” if the value is null Database Design MS Access 2007: Format for Number & Currency Data Types

Field Property: Date/Time Format Symbol Description d Day of the month in one or two digits (1 to 31) dd Day of the month in two digits (01 to 31) ddd First three letters of the weekday (Sun to Sat) dddd Fullname of the weekday (Sunday to Saturday) m, mm, mmm, mmmm Month equivalent to d, dd, ddd, dddd y Number of the day in a year (1 to 366) yy Last two digits of the year (01 to 99) yyyy Full year (0100 to 9999) w Day of the week (1 to 7) h/hh, n/nn, s/ss Hours, Minutes, Seconds (1 digit/2 digit) Pre-defined format Description Short/Medium/Long Date e.g. 2/28/2003, 28-Feb-03, Friday, February 28, 2003 Short/Medium/Long Time e.g. 13:00, 1:00 PM, 1:00:00 PM General Date Combination of Short date and Long Time as needed e.g. 2/28/2003 1:00:00 PM Example: ddd", "mmm d", "yyyy  Fri, Feb 28, 2003 Database Design MS Access 2007: Format for Date/Time Data Type

Field Property: Input Mask Symbol Description Required digit (0 to 9) 9 Optional digit or space (0 to 9) L Required letter ? Optional letter A Required letter or digit a Optional letter or digit & Required character or space C Optional character or space # Required digit, space, or +/- Password Display entry with * Section Description First Specifies the input mask Second Specifies whether the data is stored with the literal display characters. - 0 to include literal characters, 1 or blank to store typed characters only Third Specifies the display character for data input positions Data input template a set of literal and mask characters that control what can and cannot be entered in a field to prevent invalid data entry e.g. (999) 000-0000;;_ data entry: (___) ___-____  (812) 855-5111 data storage: 8128551111 area code is optional e.g. >L<?????????????? A first of last name with the first letter automatically capitalized Database Design MS Access 2007: Input Mask

Field Property: Format vs. Input Mask Input Mask property To control how data is entered Affects how data is displayed during data entry Can affect how data is stored Format property To display data in a consistent format Affects how data is displayed after it is saved Does not affect how it is stored Decimal Places property (for Number data type) Specifies the number of decimal places to display Must use Field Size property to change how a number is stored Has no effect if Format property is blank or set to “General Number” Database Design

Field Property: Validation Rule Validates & Restricts data entry Validation Text holds the error message to be displayed Use “expression” to define validation rules expression is a combination of operators, fields, functions, etc. expression can be constructed using the Expression Builder Other Data validation in MS Access Data Type – e.g., Date/Time Field Size – e.g., 20 char for last name Required – e.g., Yes to require data entry Input Masks – e.g., 00000-9999 for zipcode Examples Validation Rule Description <> 0 Entry must be non-zero >1000 Or Is Null Entry must be greater than 1000 or blank Like “A????” Entry must be 5 characters and begin with the letter “A” >= #1/1/96# And <#1/1/97# Entry must be a date in 1996 Database Design MS Access 2007: Validation Rule

Access Table: Misc. Field Properties Indexed create internal record of the field values for searching Access updates all of its indexes every time a table record is added or updated too many indexed fields can slow down data entry Primary key field should be set to “Yes (No Duplicates)” exception: set composite primary key fields to “Yes (Duplicates OK)” Required Yes/No to indicate whether the data entry is mandatory Allow Zero Length Yes/No to indicate whether a zero-length string (“”) is a valid entry Caption label for the field (default= field name) Default Value value automatically entered for new records Unicode Compression compresses Unicode character representation 2 bytes to 1 byte when the first byte is 0 (e.g. English) IME Mode set Input Method Editor Mode (e.g. Hangul) Database Design MS Access 2007: Field Properties Quick Reference

MS Access: Null vs. Zero-length string A variable state indicating missing data Information that may exist but is unknown i.e., “I don’t know what the value is.” e.g., CUS_FAXNUM is set to Null initially. Created by pressing ENTER key in a field Zero-length string To handle unknown values in required fields Information that does not exist i.e., “I know there is no value.” e.g., CUS_FAXNUM is set to zero-length string after discovering that the customer has no fax. Created by entering two double quotes (“”) in a field Database Design