Databases part 2 – field properties

Slides:



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

Copyright © 2008 Pearson Prentice Hall. All rights reserved.1 1 Committed to Shaping the Next Generation of IT Experts. Chapter 2.1: Relational Databases.
MS-Access XP Lesson 1. Introduction to MS-Access Database Management System Software (DBMS) Store data in databases Database is a collection of table.
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.
Data type – determines the type of data and range of values that can be entered in a field.
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.
XP New Perspectives on Microsoft Access 2002 Tutorial 51 Microsoft Access 2002 Tutorial 5 – Enhancing a Table’s Design, and Creating Advanced Queries and.
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.
© Paradigm Publishing, Inc Access 2010 Level 2 Unit 1Advanced Tables, Relationships, Queries, and Forms Chapter 1Designing the Structure of Tables.
 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.
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 1-1 LINKS TO OBJECTIVES Design Tables and Fields Design Tables and Fields Data Types Field Size Property.
XP Chapter 1 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Preparing To Automate Data Management Chapter 1 “You.
Using Microsoft Access 56:150 Information System Design.
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.
Databases,Tables and Forms Access Text by Grauer Chapters 1 & 2.
IE 423 – Design of Decision Support Systems Database development – Building Tables
A Skills Approach Access 2010 Working with Tables © 2012 The McGraw-Hill Companies, Inc. All rights reserved Chapter 2.
Introduction to Database using Microsoft Access 2013 Part 6.1 November 18, 2014.
Relational Database Techniques
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.
Mr C Johnston ICT Teacher
C REATING & D ESIGNING A D ATABASE 1. C REATING A D ATABASE 2 There are two different ways to create a new Access database: 1. Start from scratch with.
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.
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,
To play, start slide show and click on circle Access 1 Access 2 Access 3 Access 4 Access Access
BTEC NCF IT Unit 02 Creating Systems to Manage Information Lesson 05 – Data Types Mr C Johnston.
N5 Databases Notes Information Systems Design & Development: Structures and links.
DB Implementation: MS Access Tables
DATA TYPES.
Databases Chapter 9 Asfia Rahman.
Guidelines for Designing Databases
Building Tables & Defining Relationships
GO! with Microsoft Office 2016
Microsoft Office Access 2010 Lab 2
Exploring Microsoft Access 97
Unit 16 – Database Systems
Types of data This presentation differentiates between ICT professional and end users.
GO! with Microsoft Access 2016
BTEC NCF IT Unit 02 Creating Systems to Manage Information Lesson 05 – Data Types Mr C Johnston.
Data Types and Field Properties
Introduction to Access 2003
DB Implementation: MS Access Tables
MODULE 7 Microsoft Access 2010
Access Lesson 2 Creating a Database
Data Types and Field Properties
Data Types and Field Properties
MS ACCESS.
Microsoft Access Validation Rules, Table Relationships And
ICT Database Lesson 2 Designing a Database.
Data Types and Field Properties
Grauer and Barber Series Microsoft Access Chapter Two
Data Types and Field Properties
Introduction to MS ACCESS
Chapter 2 Design Table and Form.
Lecture 2 Lecturer: awdang aziz MS access
Chapter 2 Design Table and Form.
Data Types and Field Properties
Data Types and Field Properties
Presentation transcript:

Databases part 2 – field properties Chapter 9 Asfia Rahman

Steps to create relationship Identify entities Determine fields Determine field sizes Establish relationships Make ERD Implement the tables in Access Apply validations Make relationships Paper work Asfia Rahman

Data types Data type Use Text Use for alphanumeric characters, including text, or text and numbers, that are not used in calculations (for example, a product ID). Memo Use for text greater than 255 characters in length, or for text that uses rich text formatting. Examples include notes, lengthy descriptions, and paragraphs that use text formatting, such as bold or italics. Use the Text Number Use for storing numeric values (integers or fractional) that will be used in calculations, except for monetary values. NOTE: Use the Currency data type for monetary values. Date/Time Use for storing date and time values. Note that each stored value includes both a date component and a time component. Currency Use for storing monetary values (currency). AutoNumber Use for generating unique values that can be used as a primary key, which Access inserts when a record is added. Note that AutoNumber fields can be incremented sequentially or by a specified increment, or assigned randomly. Yes/No Use for Boolean values: Yes/No, True/False, or On/Off. OLE Object Use for storing OLE objects from other Microsoft Windows programs. (Pictures) Attachment Use for storing binary files (that is, files that you cannot read by using a text editor), such as digital images (photos and graphics) or files created by using other Microsoft Office products. You can attach more than one file per record to an Attachment field. Hyperlink Use for storing hyperlinks, which provide single-click access to Web pages through a URL (Uniform Resource Locator) or to files through a name in UNC (universal naming convention) format. You can also link to Access objects that are stored in a database. Lookup Wizard Use to start the Lookup Wizard so that you can create a field that uses a combo box to look up a value in another table, query, or list of values. Note that Lookup Wizard is not an actual data type. Asfia Rahman

Field properties in access Field size Format Input mask Caption Default value Validation rule Validation text Required Allow zero length Indexed Email field properties in the Customer table Asfia Rahman

1. Field size Text (Short text/long text) Number Maximum number you can enter in the field. Max number is 255. Number The size and type of number Byte, integer, long integer, Single, Double, Decimal Most common are long integer and double Asfia Rahman

2. Format Display layout for the field. You can select a pre-defined or custom format For pre- defined NUMBERS General number -  Displays the number as it was entered. Currency - Displays the number by using the thousand separator, and applies the windows settings for currency ($ or pounds). 3456.789 is displayed as $3,456.79. Euro - Displays the number using the Euro currency symbol, regardless of the symbol specified in the Regional and Language Options.  3456.789 is displayed as €3,456.79, Fixed – Displays at least one digit and applies the settings in the Regional and Language Options in Control Panel. For example, 3456.789 is displayed as 3456.79. Standard - Displays the number by using the thousand separator and applies the settings in the windows. This format does not display a currency symbol. Percentage - Multiplies the value by 100 and displays the number with a percent sign appended to the end. 0.3456 is displayed as 35%. Scientific - Displays the value in standard scientific notation. 3456.789 is displayed as 3.46E+03. Asfia Rahman

2.1 Custom Formats in Access The data in your database comes with predefined formats but when you want something different, you can use custom formats. Since custom formatting only changes how the data is displayed, you don’t have to worry about any changes to the data To create a custom format, you’ll enter various characters in the Format property of a table field. The characters can be placeholders (such as 0 and #), separators (such as periods and commas), literal characters, and colors based on how you want the formatting to be. Custom number formats can have one to four sections with semicolons (;) as the list separator. Each section contains the format specification for a different type of number. Section Description First The format for positive numbers. Second The format for negative numbers. Third The format for zero values. Fourth The format for Null values. $#,##0.00[Green];($#,##0.00)[Red];"Zero";"Null" Asfia Rahman

Example of custom formatting: #,###.##;(#,###.##)[Red];0,000.00;"Undefined" Here’s what the formatting means The number sign (#) is a Placeholder for digits. If there are no values, Access displays a blank space. To display zeroes instead of blank spaces.  For example: to display 1234 as 1234.00, use the number 0 as the placeholder like this ####.00. Positive values with two decimal places. Negative values with two decimal places, in parentheses and red type. Zero values as the number 0, always with two decimal places. Null values as the word "Undefined." Asfia Rahman

If you choose to create a format for each type of value, you must put the format for positive values first, the format for negative values second, the format for zero values third, and the format for null values last. Also, you must separate each format with a semicolon. If you use multiple sections but don't specify a format for each section, entries for which there is no format will either display nothing or default to the formatting of the first section. Asfia Rahman

Digit placeholder. Display a digit or 0. Symbol Description . (period) Decimal separator. Separators are set in the regional settings in Windows. , (comma) Thousand separator. Digit placeholder. Display a digit or 0. # Digit placeholder. Display a digit or nothing. $ Display the literal character "$". % Percentage. The value is multiplied by 100 and a percent sign is appended. Asfia Rahman

0;(0);;"Null" Display positive values normally; display negative values in parentheses; display the word "Null" if the value is Null. +0.0;–0.0;0.0 Display a plus (+) or minus (–) sign with positive or negative numbers; display 0.0 if the value is zero. Asfia Rahman

Zero-length string ("") 5 -5 0.5 1 0.00 5.00 -5.00 0.50 #,##0 Format (Style) "5" formatted as "-5" formatted as "0.5" formatted as "0" formatted as Zero-length string ("") 5 -5 0.5 1 0.00 5.00 -5.00 0.50 #,##0 $#,##0;($#,##0) $5 ($5) $1 $0 $#,##0.00;($#,##0.00) $5.00 ($5.00) $0.50 $0.00 0% 500% -500% 50% 0.00% 500.00% -500.00% 50.00% 0.00E+00 5.00E+00 -5.00E+00 5.00E-01 0.00E-00 5.00E00 -5.00E00 0.00E00 "$#,##0;;\Z\e\r\o" $-5 Zero Asfia Rahman

Boolean format For Yes/No True/False — Displays the value as either True or False. Yes/No — Displays the value as either Yes or No. On/Off — Displays the value as either On or Off. NOTES:  True=Yes=On = -1 and False=No=Off = 0 Asfia Rahman

3. Input masks To restrict data entry ? – may enter letter (optional), Helps with validation A – must enter letter or digit (obligatory), Checks data while its being typed a – may enter letter or digit (optional), mask can be designed with a mask creator (text or data/time fields) or manually & – any character or space (obligatory), C – any character or space (optional), according to the pattern. . , : ; - / – separators, The most common symbols are: < – all letters will be converted to lower case, 0 – digit (obligatory), > – all letters will be converted to upper case, 9 – digit or space character (optional), n – any following character will be displayed as a regular one; # – digit, space, + or - (optional, in edition mode spaces are displayed as empty places but they are removed when saving data), Setting the input mask property to “Password” creates a format for entering passwords. Any character will be displayed as an asterisk “*”. L – must enter letter (obligatory), Asfia Rahman

Input masks example (000) 000-0000 (206) 555-0199 This input mask Provides this type of value Notes (000) 000-0000 (206) 555-0199 In this case, you must enter an area code because that section of the mask (000, enclosed in parentheses) uses the 0 placeholder. (999) 000-0000! (206) 555-0199 ( ) 555-0199 In this case, the area code section uses the 9 placeholder, so area codes are optional. Also, the exclamation point (!) causes the mask to fill in from left to right. (000) AAA-AAAA (206) 555-TELE Allows you to substitute the last four digits of a U.S. style phone number with letters. Note the use of the 0 placeholder in the area code section, which makes the area code mandatory. #999 -20 2000 Any positive or negative number, no more than four characters, and with no thousands separator or decimal places. >L????L?000L0 GREENGR339M3  MAY R 452B7 A combination of mandatory (L) and optional (?) letters and mandatory numbers (0). The greater-than sign forces users to enter all letters in uppercase. To use an input mask of this type, you must set the data type for the table field to Text or Memo. 00000-9999 98115- 98115-3007 A mandatory postal code and an optional plus-four section. >L<?????????????? Maria Pierre A first or last name with the first letter automatically capitalized. ISBN 0-&&&&&&&&&-0 ISBN 1-55615-507-7 A book number with the literal text, mandatory first and last digits, and any combination of letters and characters between those digits. >LL00000-0000 DB51392-0493 A combination of mandatory letters and characters, all uppercase. Use this type of input mask, for example, to help users enter part numbers or other forms of inventory correctly. Asfia Rahman

4. caption Label to display if the control is used in a FORM Helps in designing of the forms when automatically generating FORMS Asfia Rahman

5. Default value Any value that will be saved no matter the user inputs the data or not. Helps in maintain data integrity and consistency. Helps in applying presence checks Asfia Rahman

6. Validation rules Restrict data entry Checks data after its entered. There are a variety of validation rules that can be used within a database including: lookup in list (by looking up in a list entered within the rule) lookup in list (by using referential integrity) lookup in list (by using a lookup table) range data type format length presence. Asfia Rahman

Text validations Wildcard characters: The asterisk (*) represents zero or more characters. ? to match a single character # character plays a similar role, but it represents a number Asfia Rahman

Like "[A-Z][A-Z][A-Z][A-Z][A-Z][A-Z][A-Z]" Square brackets can restrict any character to certain letters or symbols. Suppose your company uses an eight-character product code that always begins with A or E. Here’s the validation rule you need: Like "[AE]???????" Note that the [AE] part represents one character, which can be either A or E. If you wanted to allow A, B, C, D, you’d write [ABCD] instead, or you’d use the handy shortcut [A-D], which means “allow any character from A to D, including A and D.” An expression which allows a seven-letter word and doesn’t allow numbers or symbols. It works by repeating the [A-Z] code (which allows any letter) seven times. Like "[A-Z][A-Z][A-Z][A-Z][A-Z][A-Z][A-Z]" Asfia Rahman

Text validation examples Like "R*" Like "*ed" Like "*a*b*" Like "*@*.*" Like "?????0ZB" Like "#####0ZB" Like "a?b?c“ Like ??*@??*.??* ?* Asfia Rahman

example Type Field Rule Lookup in list Gender "M" or "F" Title IN ("M r", "Mrs", "Miss", " Dr") Range Date of Birth >DATE() (must be after today 's date) Date Joined > 28/02/1995 Reorder Amount Between 1 and 2000 Reorder Level  >0 Data Type State  (must be two text characters) Like “[A-Z][A-Z]” Format  Email Address Like "*@*.*" (* means an character)  Length  Colour  Like 'c??" (must be two characters) Presence  Forename  IS NOT NULL Asfia Rahman

Operator Function Example NOT Tests for converse values. Use before any comparison operator except IS NOT NULL. NOT > 10 (the same as <=10). IN Tests for values equal to existing members in a list. Comparison value must be a comma-separated list enclosed in parentheses. IN ("Tokyo","Paris","Moscow") BETWEEN Tests for a range of values. You must use two comparison values — low and high — and you must separate those values with the AND separator. BETWEEN 100 AND 1000 (the same as >=100 AND <=1000) LIKE Matches pattern strings in Text and Memo fields. LIKE "Geo*" IS NOT NULL Forces users to enter values in the field. This is the same as setting the Required field property to Yes. However, when you enable the Required property and a user fails to enter a value, Access displays a somewhat unfriendly error message. Typically, your database is easier to use if you use IS NOT NULL and enter a friendly message in the Validation Text property. AND Specifies that all parts of the validation rule must be true. >= #01/01/2007# AND <=#03/06/2008# NOTE:  You can also use AND to combine validation rules. For example: NOT "UK" AND LIKE "U*". OR Specifies that some but not all parts of the validation rule must be true. January OR February < Less than. <= Less than or equal to. > Greater than. >= Greater than or equal to. = Equal to. <> Not equal to. Asfia Rahman

Value must be zero or greater. -or- You must enter a positive number. Validation rule Validation text <>0 Enter a nonzero value. >=0 Value must be zero or greater. -or- You must enter a positive number. 0 or >100 Value must be either 0 or greater than 100. BETWEEN 0 AND 1 Enter a value with a percent sign. (For use with a field that stores number values as percentages). <#01/01/2007# Enter a date before 2007. >=#01/01/2007# AND <#01/01/2008# Date must occur in 2007. <Date() Birth date cannot be in the future. >=Int(Now()) Enter today's date. M Or F Enter M for male or F for female. LIKE "[A-Z]*@[A-Z].com" OR "[A-Z]*@[A-Z].net" OR "[A-Z]*@[A-Z].org" Enter a valid .com, .net, or .org e-mail address. [RequiredDate]<=[OrderDate]+30 Enter a required date that occurs no more than 30 days after the order date. [EndDate]>=[StartDate] Enter an ending date on or after the start date. Asfia Rahman

using input masks for email addresses Because email addresses vary widely in the number of characters they contain, input masks are not a good tool for ensuring that email addresses are entered correctly. Instead, we recommend using the Validation Rule and Validation Text properties. The validation rule shown in the following table ensures that the email address is entered with one or more characters, then an “@” sign, then one or more characters, then a period, and then one or more characters. For example, tom@example.com would be allowed, but tom@example,com or tom@example would not. If you enter an email address that doesn’t match the validation rule, Access doesn’t accept the input and displays the message in the Validation Text property. If no text is entered in the Validation Text property box, Access displays a generic message. Validation Rule Is Null Or ((Like "*?@?*.?*") And (Not Like "*[ ,;]*")) Validation Text(optional) Please enter the email address with an '@' sign and the full domain name (for example, 'frank@contoso.com'). Asfia Rahman

required Require data in this field? If selected YES, user must enter data, cannot leave blank Helps in implementing presence check Asfia Rahman

Allow zero length Can user enter 0 length strings? Applies to TEXT data types Asfia Rahman

indexed Selecting “Yes, No duplicates” prohibits any repetition of data. Helps when creating one-to-one relationships Asfia Rahman

Task Open the database 9_01 Review all tables List the entities Write the attributes Specify data types and field sizes used Make the ERD Note down any type of data restriction/validation used on the fields and explain what is being done. Asfia Rahman