44220: Database Design & Implementation Review & Assignment 2 Ian Perry Room: C41C Tel Ext.: 7287 E-mail: I.P.Perry@hull.ac.uk http://itsy.co.uk/ac/0708/sem2/44220_DDI/ Data, Information, … Ian Perry 44220: Database Design & Implementation: Review & Assignment 2 Slide 2 The ‘Data Modelling Stack’ Conceptual Overview of things Logical Physical Ian Perry that are perceived to be of ‘interest’ in the ‘real’ world. Data elements & the relationships between those elements in a tabular form. Actual data held in a database & the means to manipulate that data. Model of the Business System. (ER Model) Model of Data Storage Theory (Db Schema) Physical Implementation (RDBMS) 44220: Database Design & Implementation: Review & Assignment 2 Slide 3 Conceptual Model - ER Diagram Staff, Student, Course (SSC) Team M 1 <= taught by M <= part of Indicates Mandatory Participation Course 1 Pay Ian Perry 1 <= paid at applies to => M Staff 1 tutor for => M <= tutored by 44220: Database Design & Implementation: Review & Assignment 2 Student Slide 4 Logical Model – Schema & Domains Schema: SSC Domains: Ian Perry StudentIdentifiers: Number, from 1 to 9999 Titles: Text, >=2 & <= 4 Characters, First Char Caps, e.g. Mr, Ms, Mrs, Miss, Prof, Dr. PersonNames: Text, <= 12 Characters, First Char Caps. OPoints: Number, from 0 to 100. StaffIdentifiers: Number, from 1001 to 1199. SPoints: Number, from 1 to 6. StaffBirthDates: Date, dd/mm/yyyy, >= 21 years before today. PayRates: Money, from £15,000 to £20,000, in £1,000 increments. CourseIdentifiers: Number, from 101 to 110. CourseNames: Text, <= 15 Characters, First Char Caps. CourseDurations: Number, 3, 6, 9 or 12 (Months). 44220: Database Design & Implementation: Review & Assignment 2 Slide 5 Logical Model – Relations 1 Relation: Student EnrolNo: StudentIdentifiers Title: Titles FirstName: PersonNames SurName: PersonNames OLevelPoints: OPoints Tutor: StaffIdentifiers Primary Key: EnrolNo Foreign Key: Tutor references Staff.StaffID Relation: Staff Ian Perry StaffID: StaffIdentifiers Title: Titles FirstName: PersonNames FamilyName: PersonNames ScalePoint: SPoints DOB: StaffBirthDates Primary Key: StaffID Foreign Key: ScalePoint references Pay.ScalePoint 44220: Database Design & Implementation: Review & Assignment 2 Slide 6 Logical Model – Relations 2 Relation: Pay Relation: Team ScalePoint: SPoints RateOfPay: PayRates Primary Key: ScalePoint CourseCode: CourseIdentifiers StaffID: StaffNumbers Primary Key: CourseCode & StaffD Foreign Key: CourseCode references Course.CourseCode Foreign Key: StaffID references Staff.StaffID Relation: Course Ian Perry CourseCode: CourseIdentifiers Name: CourseNames Duration: CourseDurations Primary Key: CourseCode 44220: Database Design & Implementation: Review & Assignment 2 Slide 7 What is a Physical Data Model? The Physical Implementation (hardware & software) of a Logical Data Model: Physical Data Model must enable: it is useless to progress to this stage of database development if your Logical Data Model is NOT demonstrably ‘robust’. data to be stored (& maintained) in structured manner. retrieval of specific groupings of data (information?). There may be several constraints: Ian Perry depending upon the software application chosen. 44220: Database Design & Implementation: Review & Assignment 2 Slide 8 Logical => Physical i.e. translate a ‘logical’ Database Schema into a ‘physical’ Database: Schema Relations Attributes Domains Key Fields Ian Perry => => => => => Database Tables Field Names Data Type Field Size Input Mask Validation Rule Relationships 44220: Database Design & Implementation: Review & Assignment 2 Slide 9 Physical Implementation - 1 Ian Perry 44220: Database Design & Implementation: Review & Assignment 2 Slide 10 Physical Implementation - 2 The ‘Team’ Table has composite Primary Key, consisting of BOTH; CourseCode & StaffID You MUST set up relationships between ALL of the Tables of your Database, with referential integrity enforced, BEFORE you; ADD any DATA to your Tables, BUILD any QUERIES to answer Questions. Ian Perry 44220: Database Design & Implementation: Review & Assignment 2 Slide 11 Implementing ‘rules’ of Domains Access provides 4 main ways to control the data that can be entered into individual fields. Data Type Field Size (or Format) to control the range of allowable values that can be entered into a field. Input Mask Ian Perry depends upon the Data Type chosen. Validation Rule Number, Text, Memo, Date/Time, Currency, etc. to force the data that is entered to conform to a particular shape/pattern. 44220: Database Design & Implementation: Review & Assignment 2 Slide 12 Assignment 2 (50% of Module Marks) Deadline? Read the Case Study carefully: Friday, the 9th of May. Your Database MUST be able to ‘answer’ the 10 questions at the end of the Learn-by-Post Case Study. Two parts: implement your logical data model as a physical data model, using Microsoft Access; Ian Perry Using Data Type, Field Size, Input Masks & Validation Rules as appropriate in order to constrain domains. test this implementation thoroughly, by building 10 Database Queries; i.e. prove that the information requirements can actually be delivered. 44220: Database Design & Implementation: Review & Assignment 2 Slide 13 Answer the Questions I have set! 1. Implement a Physical Data Model, i.e. a Microsoft Access Database; which supports requirements of the Case Study organisation. (50 Marks) This Physical Data Model MUST be developed using Microsoft Access. Marks here will be awarded with respect to the following: Ian Perry Tables – are there sensible Table Names, Field Names & choice of Key Fields. Domains – how well have you attempted to control data entry by use of Data Type, Field Size, Input Mask, Validation Rule, etc. Relationship Diagram – does it show all of the relationships, with referential integrity enforced, between the all of the above Tables? NB. If you can’t enforce referential integrity for every relationship, then there is a problem with your database design/implementation. 44220: Database Design & Implementation: Review & Assignment 2 Slide 14 Answer the Questions I have set! 2. Test this Physical Data Model; by developing a number of Queries that show that your database can deliver the information requirements, i.e. can answer the 10 questions from the Case Study. (50 Marks) These Database Queries MUST be developed using Microsoft Access. You MUST develop 10, clearly named, queries (each worth 5 Marks) that provide ‘reasonable’ answers to the Questions of the Case Study organisation; e.g.: A. Who are our students? B. Which tutors are module co-ordinators, and for which modules? C. Which students should be sent a certificate for module X? AND remember to ADD ‘enough’ test data to your database tables; Ian Perry in order to demonstrate that your Database can provide a ‘reasonable’ answer to each of the 10 questions. 44220: Database Design & Implementation: Review & Assignment 2 Slide 15 The 10 Questions (5 Marks each) Your database MUST be able to ‘answer’ the following questions: A. Who are our students? B. Which students should attend examination centre X? C. What is the assessment/examination weighting for all of the available modules? D. Which tutor(s) is/are on the team for module X? E. Which tutors are module co-ordinators, and for which modules? F. Which module(s) has student X already taken? G. What module(s) is/are student X currently studying? H. Which modules are not yet fully marked & who is the module coordinator? I. Which students should be sent a certificate for module X? J. Which module is the most difficult to pass? NB. Where the examination centre, module, or student is an X, then the user of the Database MUST be able to choose from at least 2 different values. Therefore, the queries that ‘answer’ these questions MUST BE parameter-based queries. Ian Perry 44220: Database Design & Implementation: Review & Assignment 2 Slide 16 Get on with it! No More Lectures TWO Assignment 2 Support Workshops i.e. this week & next. If you want any help with Assignment 2, then make sure that you come to these support sessions prepared to ask sensible questions. You may be ‘glad’ to hear? “Where do I begin?” - is NOT a sensible question! Assignment 2 Deadline: th of May. Friday, the 9 Ian Perry 44220: Database Design & Implementation: Review & Assignment 2 Slide 17