McGraw-Hill/Irwin ©2005 The McGraw-Hill Companies, All rights reserved ©2005 The McGraw-Hill Companies, All rights reserved McGraw-Hill/Irwin
McGraw-Hill/Irwin ©2005 The McGraw-Hill Companies, All rights reserved Extended Learning Module J IMPLEMENTING A DATABASE WITH MICROSOFT ACCESS
J-3 STUDENT LEARNING OUTCOMES 1.Identify the steps necessary to implement the structure of a relational database using the data definition language provided by Microsoft Access
J-4 STUDENT LEARNING OUTCOMES 2.Demonstrate how to use the data manipulation subsystem in Access to enter and change information in a database and how to query that information
J-5 STUDENT LEARNING OUTCOMES 3.Explain the use of the application generation subsystem in Access to create reports and data entry screens
J-6 INTRODUCTION In Figure J.1 on the following 3 slides that follow the next, we’ve recreated the correct database structure from Extended Learning Module C Revisit Module C if you need a refresher
J-7 INTRODUCTION The steps to creating a database are 1.Define entity classes and primary keys 2.Define relationships among the entity classes 3.Define fields for each relation (file) 4.Use a data definition language to create the database, which is the focus of this Module
J-8 INTRODUCTION
J-9 INTRODUCTION
J-10 INTRODUCTION
J-11 Creating the Solomon Enterprises Database Data dictionary - contains the logical structure for the information To create the Solomon Enterprise database perform the following steps: 1.Start Microsoft Access 2.Select Blank Database (or select File and New) and then Blank Database on the right side of the screen 3.Select a folder for the database and enter a file name (we’ll use Solomon Enterprises.mdb) 4.Click on Create
J-12 Creating the Structure of the Solomon Enterprises Database
J-13 Creating the Structure of the Solomon Enterprises Database To create a relation (table) in Design view: – make sure the Tables tab is selected and then double-click on Create table in Design view –Enter a name, data type, and description (the last is optional) for each field in a given relation –Save that structure and repeat the process until you’ve created the structure for each relation in your database
J-14 Creating the Structure of the Solomon Enterprises Database
J-15 Creating the Raw Material Relation Enter the four fields of the Raw Material relation –Raw Material ID –Raw Material Name –QOH –Supplier ID Click on the Raw Material ID row and then the key button to designate Raw Material ID as the primary key
J-16 Creating the Raw Material Relation
J-17 Creating the Concrete Type Relation
J-18 Creating the Bill of Material Relation We created (in Extended Learning Module C) the Bill of Material relation to eliminate the many-to-many relationship between the Concrete Type and Raw Material relations
J-19 Creating the Bill of Material Relation The Bill of Material relation has a primary key composed of two fields (composite primary key): –Concrete Type –Raw Material ID Composite primary key - consists of the primary key fields from the two intersecting relations
J-20 Creating the Bill of Material Relation
J-21 DEFINING RELATIONSHIPS WITHIN THE SOLOMON’S DATABASE The final structural task is to define how all the relations relate to each other That is, link primary and foreign keys Foreign key - a primary key of one file (relation) that appears in another file (relation)
J-22 Primary and Foreign Key Logical Ties
J-23 Defining the Relationships between the Relations To create relationships –Click on the Relationships button in the button bar –Make each relation appear on the palette by highlighting each relation name and clicking on Add –Then click on the Close button
J-24 Defining the Relationships between the Relations
J-25 Defining the Relationships between the Relations
J-26 ENTERING INFORMATION INTO THE SOLOMON DATABASE To enter information, you simply highlight the desired relation and click on Open
J-27 Entering Information into the Supplier Relation
J-28 Entering Information into the Supplier Relation To enter information, highlight the appropriate relation and click on Open
J-29 Entering Information into the Supplier Relation The datasheet view looks like a spreadsheet When you close the relation, the information is automatically saved
J-30 Referential Integrity Referential integrity ensures consistency. For example, that you don’t put a non-existent Supplier ID into the Raw Material relation The relationships we set up for referential integrity guards against bad information Integrity contraints – rules that help ensure the quality of the information
J-31 Enforcing Referential Integrity
J-32 Changing the Structure of a Relation
J-33 CREATING A SIMPLE QUERY USING ONE RELATION Query-by-example (QBE) tool - helps you graphically design the answer to a question Suppose we wanted to see a list of raw materials that shows –Raw Material Name –Supplier ID
J-34 Creating a Simple Query Using the Raw Material Relation
J-35 Creating a Simple Query Using the Raw Material Relation
J-36 Creating a Simple Query with a Condition Our criteria The result
J-37 CREATING AN ADVANCED QUERY USING MORE THAN ONE RELATION Suppose we want a query that shows –All order numbers –Date of orders –Where the goods were delivered –The contact person –The truck involved in each delivery –The truck driver in each delivery
J-38 Steps to Create an Advanced Query 1.Select the Queries tab 2.Double-click on Create query in Design view
J-39 Steps to Create an Advanced Query 3.In the Show Table dialog box Select and Add the relation names Close the Show Table dialog box Tables linked appear are joined by lines with 1 beside the table with the primary key the infinity sign by the table with the foreign key
J-40 Steps to Create an Advanced Query 4.Drag and drop the fields that you want from the appropriate relation into the QBE grid in the order that you want
J-41 Steps to Create an Advanced Query
J-42 Steps to Create an Advanced Query
J-43 Steps to Create an Advanced Query 5.Click on the exclamation point (Run) in the button bar to see the results of the query
J-44 The Results of the Advanced Query
J-45 GENERATING A SIMPLE REPORT 1. Select the Reports tab 2. Double-click on Create report by using wizard 3. Choose tables and/or queries: Lets you choose which table/query you want 4. Choose fields: Lets you choose the fields you want
J-46 Grouping, Sorting, Layout of Report 5.Grouping: Lets you specify grouping of information (we chose the default) 6.Sorting: Allows you to specify sorting (we chose the default) 7.Layout and orientation: Allows you to select layout and page orientation (we chose the default)
J-47 Style and Header of Report 8.Style: Allows you to choose from among predefined report styles (we chose the default) 9.Report header: Allows us to enter a title for the report.
J-48 Choose Table/Query and Fields Select Reports tab and click Create report by using wizard Highlight the desired fields and click on >
J-49 Grouping, Sorting, Layout, Style and Title
J-50 Final Report
J-51 GENERATING A REPORT WITH GROUPING, SORTING, AND TOTALS Say we want to create the Supply Chain Management report from Extended Learning Module C First, create a query Then, put the query into the report generator
J-52 Steps for Creating a Report with Grouping, Sorting and Totals 1. Select the Reports tab 2. Double click Create report by using wizard 3. Choose tables/queries: Query: Supply Chain Query 4. Choose fields: Select all fields by clicking on the double greater-than sign (>>)
J-53 Specify Table/Query and Fields
J-54 Grouping and Sorting Information 5.Top-level grouping: Allows you to choose ordering. Since we created a query, Access has defaulted to the first field 6.Further grouping: Lets you specify groups within the top grouping of Concrete Type, but we don’t want any further grouping 7.Sorting: Next we have a chance to sort our information
J-55 Steps for Grouping Information
J-56 Step for Sorting Information We chose to sort in descending order by Raw Material ID
J-57 Totaling Information in Report 8.Totaling: The sorting screen also has a Summary Options button –Within Summary Options you can choose what type of summary you want
J-58 Totaling Information in Report
J-59 Formatting the Report 9. Overall structure of report: Allows you to choose the layout and orientation 10. Style of report: Allows you to choose a style 11. Report heading: Allows you to enter the title that will appear on the report, then click on Finish
J-60 Formatting the Report
J-61 Final Report Place holder for Figure J.21 Doesn’t make sense – title is final report yet asking for Figure J.21. Finale report is last screen in Figure J.20, which is never displayed
J-62 Refining the Report Steps to adjust the report to make it aesthetically pleasing –Open the report in Design View with the triangle button –Adjust the boxes to the desired size –Delete unwanted entries
J-63 Refining the Report
J-64 Adjusting the Page Header
J-65 Adjusting the Concrete Type Header
J-66 Adjusting the Detail Section
J-67 Adjusting the Concrete Type Footer
J-68 The Completed Report
J-69 CREATING A DATA INPUT FORM 1. Click on Forms and then on Create form by using wizard 2. Choose Table: Order 3. Select all the fields of the Order table
J-70 Choose Table/Query and Fields
J-71 Choose Layout, Style, and Title 4. You can choose a layout for your input form 5. This screen allows you to choose a style 6. Enter a title for the input Form and click Finish
J-72 Choose Layout and Style
J-73 Choose Title for Input Form
J-74 Final Input Form
J-75 CAN YOU… 1.Identify the steps necessary to implement the structure of a relational database using the data definition language provided by Microsoft Access
J-76 CAN YOU… 2.Demonstrate how to use the data manipulation subsystem in Access to enter and change information in a database and how to query that information
J-77 CAN YOU… 3.Explain the use of the application generation subsystem in Access to create reports and data entry screens
McGraw-Hill/Irwin ©2005 The McGraw-Hill Companies, All rights reserved Extended Learning Module J End of Extended Learning Module J