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: Shoot the Fruit Game
For these practical sessions, it would help to keep in mind a game that helps players refine their aim, like a simplified version of "Fruit Shoot". Databases play a critical role in game development, for example, databases store player information like profiles, in-game purchases, scores, and progress.
We have set up a database, shoot_the_fruit.accdb, with three tables to store data about Fruits, Users, and PlaySessions. The database organises basic information about the assets of our game, i.e., the fruits, and the user play sessions so that we can track their progress and pull some cool statistics.
Your Tutorial Starts Here
Step 1 Download shoot_the_fruit.accdb
The database is available for download so that you can have a local copy on your machine.
Step 2 Instructions to Open File in Microsoft Access
To open Microsoft Access application:
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 shoot_the_fruit.accdb and click on Open you should get a view that is similar to the screenshot hereunder.
Step 3 Interact with an Object to fill the Working Area
Double-clicking on an object e.g. Fruits Table opens it in the Working Area.
There are many view modes for objects and you can see them by performing a Right Click on the object which will display a drop-down menu.
Try to right-click on the Fruits Table object and then click on Design View as shown below. Watch what happens to the Working Area.
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. The first two sections are the most important ones of note:
Tables:
This is where records are stored. A record is made up of fields whereby each field is of a specific data type. Every record must be uniquely identified by a primary key.
Here is an exercise for you, view the Users table in Design View, Right Click > Design View, to see what details are being stored about each user.
Queries:
We can ask the database "questions" 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. You can think of these as "mini-programs" that extract data from one or more tables.
You 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.
Step 5 Fill out Google Form "Worksheet"
We do not have a physical worksheet for you to fill in this time, but, we prepared this Google Form - "Worksheet: Database Practical 1, Microsoft Access Database Intro" for you. Relax, it is not hard to do.
Step 6 Pat Yourself on the Back!
That is all for now. Well done on getting this far. You are now ready to follow along with the next practical session in the series. However, we should probably cover Chapter 33 first.
Comments