BUS2206 Access Lab Queries Second Term, 2018-19
Part I Introduction
Introduction (Based on the Lab Textbook) Creating Table (P. 13 – P. 17) Database schema Tables relationships (P. 20 – P. 22) Creating Queries (P. 17 – P. 37) QBE (Query By Example) Creating Reports (P. 37 – P. 42) Creating Forms (P. 46 – P. 48) For input control based on Tables and Queries
The Schema and Metadata Chapter 7 The Schema and Metadata Schema: a plan that describes the structure of the database, including: Names and sizes of fields Identification of primary keys Relationships Data dictionary: a repository of information about the data and its organization Also called metadata: the data about the data
Employee Table Data Dictionary
Wage Table Data Dictionary
Hours Worked Table Data Dictionary Composite Key
“Date” Input Mask Example Date format is Medium Date, such as: 04-Oct-16 In order to ensure the input date is in correct format, access uses input mask to control the input data: 00\->L<LL\-00;0;_ Where, 0 is a mandatory digit; L must be a letter; > converts letter to upper case and, < converts letter to lower case; \ keep the next character as it is.
Enter Data for Tables
Chapter 7 Data Modeling Databases must be carefully planned and designed to meet business goals Data modeling: analysis of an organization’s data and identification of the data relationships. It develops a conceptual blueprint of the database. Entity relationship diagram: a graphical representation of all entity relationships
Data Modeling (continued) Chapter 7 Data Modeling (continued) One-to-many relationship Many-to many-relationship
Create Table Relationships in Access One-to many-relationship One-to-one relationship
Part II Queries
Create Query: Hourly Pay Employees (1)
Create Query: Hourly Pay Employees (2)
Query: New Hourly Pay Rate (1) P.17
Create Query: New Hourly Pay Rate (2)
Create Query: Join Two Tables (1)
Query: Join Two Tables (2)
Query: Citizen Hourly Pay (1) P.20
Create Query: Citizen Hourly Pay (2)
Query: Calculate Wages Pay in Week 2 (1) P.21
Query: Calculate Wages Pay in Week 2 (2)
Query: Count number employees (1) P.22 Step 2 Step 1 Step 3
Query: Calculate Wages Pay (2)
Better Title for Calculate Wages Pay (3)
“Total” Field Summary P.22
Query: Average Hourly Wage (1) P.25
Query: Average Hourly Wage (2)
Query of a query: New Avg Rate (1) P.26
Query of a query: New Avg Rate (2) Calculated Field Select a query
Query of a query: New Avg Rate (3)
Query of a query: New Avg Rate (4)
Query: Date() Function (1) P.27
Query: Date() Function (2)
A new Table for Time Arithmetic(1) P.28
A new Table for Time Arithmetic(2) P.28
Query: Calculate Hours Worked (1) P.29 P.29 on why * 24
Query: Calculate Hours Worked (2)
Query: Update Records (1) P.30
Query: Update Records (2)
Query: Delete a Record (1) P.32
Query: Delete a Record (2)
Query: Delete a Record (3)
Parameter Query (1) P.32
Parameter Query ()
Query Exercise 1 P.33
Query Exercise 2 P.34
Query Exercise 3 P.35
Query Exercise 4 P.35
Query Exercise 5 P.36
Query Exercise 6 P.36
End of Access Query Lab