Exp19_Access_Ch02_ML1 – Game Collection 1.2
You have cataloged your vintage video games in an Access database. In this project, you add two tables to a database you have started? One to identify the game system that runs your game and the other to identify the category or genre of the game. Then you will join each table in a relationship so that you can query the database.
Start Access. Open the downloaded Access file named Exp19_Access_Ch02_ML1_Games. Grader has automatically added your last name to the beginning of the filename. Save the file to the location where you are storing your files.
Open the Games table and review the fields containing the game information. Close the table.
Create a new table in Design view. Add the field name SystemID and select AutoNumber as the Data Type. Add the caption System ID. Set the SystemID field as the primary key for the table.
Add a second field named SystemName with the Short Text Data Type. Change the SystemName field size property to 15. Add the caption System Name. Save the table as System.
Switch to Datasheet view and enter the following system names, letting Access assign the System ID:
Double-click the border to the right of the System Name column to set the column width to Best Fit. Save and close the table.
Create a new table in Design view. Add the field name CategoryID and select AutoNumber as the Data Type. Add the caption Category ID. Set the CategoryID field as the Primary Key for the table.
Add a second field named CategoryDescription and accept Short Text as the Data Type. Change the field size property to 25. Add the caption Category Description. Save the table as Category.
Switch to Datasheet view, and enter the following Category Description, letting Access assign the Category ID:
Close the table.
Establish relationships in the database by adding the Category, Games and System tables to the Relationships window. Close the Show Table dialog box. Create a one-to-many relationship between the SystemID field in the System table and the SystemID field in the Games table, enforcing Referential Integrity. Select the option to cascade update the related fields.
Create a one-to-many relationship between the CategoryID field in the Category table and the CategoryID field in the Games table, enforcing Referential Integrity. Select the option to cascade update the related fields. Save and close the Relationships window.
Create a simple query using the Query Wizard. From the Games table, add the GameName and Rating fields (in that order). Save the query using the title Ratings. Switch to Design view. Sort the Rating field in ascending order.
Click the gray column selector at the top of the Rating field, then click and drag the column to move it to the first position of the query design grid. Add a Total row, click in the Totalrow of the GameName column, click the arrow, and then select Count. The records will be grouped by rating, and the number of games will be counted for each group. Run, save, and close the query.
Create a new query in Design view. Add the Category, Games, and System tables to the query design window. Add the following fields to the query (in this order).
Sort the query in ascending order by GameName and run the query. Save the query as Game List and close the query.
Copy the Game List query in the Navigation pane and paste it with the name PS3 Games. Modify the query in Design view by using PS3 as the criteria for SystemName. Remove the sort by GameName and sort in ascending order by CategoryDescription. Save and run the query. Close the query.
Create a new query in Design view. Add the Category, Games, and System tables to the query design window. Add fields (in this order) to display the name of the game, its rating, the category description of the game, and the system name. You only want to display Wii games with a rating of Everyone or Teen. Because the system name is the same for the games you plan to pack and share, hide this value from the results. Save the query as Thanksgiving Games and run the query. Close the query.