university of sunderland comm2 unit 4 health information management application building keys, data...
TRANSCRIPT
University of Sunderland COMM2 Unit 4
Health Information ManagementApplication Building
Keys, Data Organisation and Relationships
COMM2QCOMM2Q
University of Sunderland COMM2 Unit 4
Learning Objectives Learning Objectives
By the end of the lesson the student will be able to:
− Understand use of keys in relational database systems
− Understand the importance of data organisation and validation
− Understand the types of relationships between tables in a relational database
University of Sunderland COMM2 Unit 4
Keys Keys
• Every record must be uniquely identifiable
University of Sunderland COMM2 Unit 4
Key exampleKey example
Customer CustomerFamily Name Jones,Ann,1 Hastings WayGiven Name Smith,John,3 Davis RoadAddress Smith,Peter,53 Front Street
Purchase Order Purchase OrderOrder number 10021,1/5/10Date 10022,1/5/10 10023,2/5/10
University of Sunderland COMM2 Unit 4
Key exampleKey example
Purchase Order Line Purchase Order Line
Line number 1,6Number of items 2,3 3,1 1,2 1,5
Stock StockItem apple,0.25Cost of item orange,0.30 pineapple,1.23 banana,0.12
University of Sunderland COMM2 Unit 4
Data Types Data Types
• Choice of Data Type
• Formatting Data
• Data Design vs Data Entry
University of Sunderland COMM2 Unit 4
Data Type exampleData Type exampleData Type Format
SizeCustomerFamily Name Text > 20Given Name Text > 20Address Text > 50
Purchase OrderOrder number Number Integer N/ADate Date Short date
N/A
University of Sunderland COMM2 Unit 4
Data Type exampleData Type exampleData Type Format
SizePurchase Order LineLine number Number Integer N/ANumber of items Number Integer
N/A
StockItem Text None
20Cost of item Currency Auto N/A
University of Sunderland COMM2 Unit 4
Validation Validation
• To ensure that data is only entered in a specific format
• Validation Rules
• Validation Text
University of Sunderland COMM2 Unit 4
Validation exampleValidation example
Validation rule Validation text
<> 0 Entry must be a non-zero
value.> 1000 Or Is Null Entry must be
blank orgreater than 1000.
Like "A????" Entry must be 5 characters
and begin with the letter "A".
>= #1/1/10# And <#1/1/11# Entry must be a date in 2010
University of Sunderland COMM2 Unit 4
Data OrganisationData Organisation
• Sorts
• Indexes
University of Sunderland COMM2 Unit 4
RelationshipsRelationships
• 1:1 – one to one
• 1:N – one to many
• N:M – many to many
University of Sunderland COMM2 Unit 4
RelationshipsRelationships
• Referential Integrity
• Foreign keys
University of Sunderland COMM2 Unit 4
Relationships exampleRelationships example
Customer CustomerFamily Name Jones,Ann,1 Hastings WayGiven Name Smith,John,3 Davis RoadAddress Smith,Peter,53 Front Street
Purchase Order Purchase OrderOrder number 10021,1/5/10,Smith,JohnDate 10022,1/5/10,Jones,Ann*Family Name 10023,2/5/10,Jones,Ann*Given Name
University of Sunderland COMM2 Unit 4
Relationships exampleRelationships example
Purchase Order Line Purchase Order Line
Line number 1,10021,6,001Order number 2,10021,3,002Number of items 3,10021,1,003*Item code 1,10022,2,001 1,10023,5,004
Stock StockItem code 001,apple,0.25Item 002,orange,0.30Cost of item 003,pineapple,1.23 004,banana,0.12
University of Sunderland COMM2 Unit 4
Learning Objectives Learning Objectives
− Understand use of keys in relational database systems
− Understand the importance of data organisation and validation
− Understand the types of relationships between tables in a relational database