To experiment with concepts that we learnt in Chapter 32 we will use a sample database. In this post we will walk you through Microsoft Access.
Setting the Scene
We have set up a database, MySchool.accdb, with four tables to store data about Students, Guardians, Settings and the relationship between Students and Guardians. The database organises basic information about the student and guardians so that teachers and staff are able to find contact information and student preferences easily.
Your Tutorial Starts Here
Step 1 Download MySchool.accdb
The database is available for download so that you can have a local copy on your machine.
Step 2 Open in Microsoft Access
Simply follow the instructions hereunder.
To open Microsoft Access, press the Windows Key and search for "Access".
From the toolbar at the top, navigate to File > Open, and browse to the file you just downloaded. It will most likely be in the Downloads folder.
When you select on MySchool.accdb and click on Open you should get the view as depicted by the screenshot hereunder.
Step 3 Interact with an Object to fill the Working Area
Simply double clicking on an Object e.g. Guardians opens it in the working area. However, there are many view modes depending on the type of object (more of this below) you want to access. You can see all the options by performing a Right Click on the object which will display a drop down menu. Below is an example of a Right Click on the Students object and the mouse cursor is hovering on Design View. Why not try it out yourself just to get warmed up?
Step 4 Use the Object Navigator
The Object Navigator is a component that helps you access various elements in the database. The component sits on the left of the screen and is split into sections:
Tables
These are your most basic object, where data is stored. Each table will have its own fields whereby each field is of a specific data type. We have learnt about these concepts in Chapter 32. Each table stores records that must be uniquely identified by a primary key. We will soon learn that it may also have foreign keys to describe a link with another table. Let us view the Students table in Design View, Right Click > Design View, to see what details are being stored about each student.
Queries
A query is a way for a programmer to ask the database a question about the data being stored. Queries are constructs written in a special language called SQL and when they are run they return some form of result. Just like mini-programs, they can be really simple and just extract data from one table, or be really complex and take data from a number of related tables! Y
ou can edit queries in Design Mode or SQL Query Mode. Let us run the Students Extended query, Right Click > Open, to see what is being returned.
Forms and Reports
Forms are input screens used to input new rows into tables in a very user friendly way. They are configured to take in data for each field in a number of related tables, where they are saved. Reports are special views that bring together data and display it in a way a person who is not a programmer can appreciate. The reports may make use of queries to fetch the data required.
Step 5 Give Yourself a Pat on the Back!
That is all for now. Well done on getting this far. You are now ready to follow along the Database related chapters, in particular Chapter 34 - Using a DBMS.
Comments