Presentation is loading. Please wait.

Presentation is loading. Please wait.

44220: Database Design & Implementation Implementing Physical Domains Ian Perry Room: C49 Tel Ext.: 7287

Similar presentations


Presentation on theme: "44220: Database Design & Implementation Implementing Physical Domains Ian Perry Room: C49 Tel Ext.: 7287"— Presentation transcript:

1 44220: Database Design & Implementation Implementing Physical Domains Ian Perry Room: C49 Tel Ext.: 7287 E-mail: I.P.Perry@hull.ac.ukI.P.Perry@hull.ac.uk http://itsy.co.uk/ac/0506/sem2/44220_DDI/

2 Ian PerrySlide 244220: Database Design & Implementation: Implementing Physical Domains The SSC Database Relations Staff (StaffID, FirstName, SurName, ScalePoint, DOB) Student (EnrolNo, FirstName, SurName, OLevelPoints, Tutor) Course (CourseCode, Name, Duration) Team (CourseCode, StaffID) Pay (ScalePoint, RateOfPay) ER Diagram Staff Course Student 1MNM

3 Ian PerrySlide 344220: Database Design & Implementation: Implementing Physical Domains Domains Schema SSC Domains StaffIdentifiers = 1001 - 1199; StudentIdentifiers = 2000 - 9999; Titles = Mr, Ms, Mrs, Dr; PersonNames = String, <= 12 Characters; CourseIdentifiers = 101 - 110; CourseNames = Computing, Law, …, Marketing; CourseDurations = 3, 6, 9, 12; OLevelPoints = 0 - 240; ScalePoints = 1 - 6; PayRates = £13,000, £13,500, …, £15,500; BirthDates = Date, >= 21 Years before Today;

4 Ian PerrySlide 444220: Database Design & Implementation: Implementing Physical Domains Relations – Staff & Student Relation Staff StaffID: StaffIdentifiers; Title: Titles; FirstName: PersonNames; SurName: PersonNames; ScalePoint: ScalePoints; DOB: BirthDates; Primary Key: StaffID Foreign Key: ScalePoint refs Pay.ScalePoint Relation Student EnrolNo: StudentIdentifiers; Title: Titles; FirstName: PersonNames; SurName: PersonNames; OLevelPoints: OLevelPoints; Tutor: StaffIdentifiers; Primary Key: EnrolNo Foreign Key: Tutor refs Staff.StaffID

5 Ian PerrySlide 544220: Database Design & Implementation: Implementing Physical Domains Relations – Course, Team & Pay Relation Course CourseCode: CourseIdentifiers; Name: CourseNames; Duration: CourseDurations; Primary Key: CourseCode Relation Team CourseCode: CourseIdentifiers; StaffID: StaffIdentifiers; Primary Key: CourseCode & Staff-ID Foreign Key: CourseCode refs Course.CourseCode Foreign Key: StaffID refs Staff.StaffID Relation Pay ScalePoint: ScalePoints; RateOfPay: PayRates; Primary Key: ScalePoint

6 Ian PerrySlide 644220: Database Design & Implementation: Implementing Physical Domains Logical => Physical Translating a Logical Model (e.g. a Database Schema) into a Physical Model (e.g. an Access Database) requires the following: Schema => Database Relations => Tables Attributes => Field Names Domains => Data Type Field Size Validation Rule Input Mask Key Fields => Relationships

7 Ian PerrySlide 744220: Database Design & Implementation: Implementing Physical Domains Physical Implementation

8 Ian PerrySlide 844220: Database Design & Implementation: Implementing Physical Domains Controlling Data Entry Access provides 4 main ways to control the data that can be entered into individual fields. Data Type Number, Text, Memo, Date/Time, Currency, etc. Field Size (or Format) depends upon the Data Type chosen. Validation Rule to control the range of allowable values that can be entered into a field. Input Mask to force the data that is entered to conform to a particular shape/pattern.

9 Ian PerrySlide 944220: Database Design & Implementation: Implementing Physical Domains Data Type & Field Size Number Default = Long Integer; However, ALWAYS store numbers using the smallest possible Field Size. Byte; whole numbers, positive only, between 0 and 255. Integer; whole numbers between –32,768 and 32,767. Long Integer; whole numbers between –2,147,483,648 and 2,147,483,647. Single; large numbers, both positive & negative, including fractions. Double; very large numbers, both positive & negative, including fractions.

10 Ian PerrySlide 1044220: Database Design & Implementation: Implementing Physical Domains Data Type & Field Size Text from 1 to 255 characters (Default = 50). Domain PersonNames = String, <= 12 Characters; Attribute FirstName: PersonNames; Field Definition Field Name :- FirstName Data Type :- Text Field Size :- 12 Memo Field Size cannot be altered, but can accommodate up to 65,535 characters.

11 Ian PerrySlide 1144220: Database Design & Implementation: Implementing Physical Domains Data Type & Format Date/Time can accommodate Date and Time values between the Years 100 and 9999. NB. Format ‘decides’ how a Date is displayed. Domain BirthDates = Date, >= 21 Years before Today; Attribute DOB: BirthDates; Field Definition Field Name :- DOB Data Type :- Date/Time Format :- Long Date

12 Ian PerrySlide 1244220: Database Design & Implementation: Implementing Physical Domains Data Type & Format Currency As with Date/Time fields, Format ‘decides’ how Currency fields are displayed. Domain PayRates = £13,000, £13,500, …, £15,500; Attribute RateOfPay: PayRates; Field Definition Field Name :- RateOfPay Data Type :- Currency Format :- Currency

13 Ian PerrySlide 1344220: Database Design & Implementation: Implementing Physical Domains Validation Rules To control the range of allowable values that can be entered into a field. e.g. Numeric Ranges Domain StaffIdentifiers = 1001 - 1199; Attribute StaffID: StaffIdentifiers; Field Definition Field Name :- StaffID Data Type :- Number Field Size :- Integer Validation Rule :- >=1001 And <=1199 Validation Text :- Must be > 1000 And < 1200

14 Ian PerrySlide 1444220: Database Design & Implementation: Implementing Physical Domains Validation Rules e.g. Specific Numbers Domain CourseDurations = 3, 6, 9, 12; Attribute Duration: CourseDurations; Field Definition Field Name :- Duration Data Type :- Number Field Size :- Byte Validation Rule :- 3 Or 6 Or 9 Or 12 Validation Text :- 3, 6, 9 or 12 months only.

15 Ian PerrySlide 1544220: Database Design & Implementation: Implementing Physical Domains Validation Rules e.g. Patterns of Text Domain Titles = Mr, Ms, Mrs, Dr; Attribute Title: Titles; Field Definition Field Name :- Title Data Type :- Text Field Size :- 3 Validation Rule :- “Mr” Or “Ms” Or “Mrs” Or “Dr” Validation Text :- Mr, Ms, Mrs or Dr only.

16 Ian PerrySlide 1644220: Database Design & Implementation: Implementing Physical Domains Input Masks To force the data that is entered to conform to a particular shape/pattern. Domain PersonNames = String, <= 12 Characters; Attribute SurName: PersonNames; Field Definition Field Name :- SurName Data Type :- Text Field Size :- 12 Input Mask :- >L<L??????????

17 Ian PerrySlide 1744220: Database Design & Implementation: Implementing Physical Domains A little bit of Everything! Always attempt to constrain the domain of each Field in as many ways as possible: Domain Titles = Mr, Ms, Mrs, Dr; Attribute Title: Titles; Field Definition Field Name :- Title Data Type :- Text Field Size :- 3 Input Mask :- >L<L? Validation Rule :- “Mr” Or “Ms” Or “Mrs” Or “Dr” Validation Text :- Mr, Ms, Mrs or Dr only.

18 Ian PerrySlide 1844220: Database Design & Implementation: Implementing Physical Domains This Week’s Workshop Implementing Physical Domains in Microsoft Access: Data Types Field Sizes Input Masks Validation Rules Remember: I will be looking carefully for evidence of you attempting to use all of the above, when judging the quality of the Implementation of your Database for Assignment 2.


Download ppt "44220: Database Design & Implementation Implementing Physical Domains Ian Perry Room: C49 Tel Ext.: 7287"

Similar presentations


Ads by Google