Database Essentials Task (DEVRY)

COs:

Given a business situation in which managers require information from a database, determine, analyze, and classify that information so that reports can be designed to meet the requirements.
Given a situation containing entities, business rules, and data requirements, create the conceptual model of the database using a database modeling tool.
Given an existing relational database schema, evaluate and alter the database design for efficiency.
Given an existing database structure demonstrating efficiency and integrity, design the physical tables.
Scenario:

You have been asked to create a conceptual database model using MS Visio Database Model Diagram Template. The purpose of this lab is to have you gain experience with the various modeling tools needed to create a conceptual model (entity relationship diagram) of a database. You will then modify the model for implementation as a MS Access database. You will create and modify one conceptual model.

You will then create a MS Access database based on the model developed in Visio, creating the necessary tables and relationships.

Upon completing this lab, you will be able to

relying on detailed instructions, add two entities to the existing conceptual model (ERD), including attribute data types and required field lengths;
create a new MS Access database file;
using the model from Part A of the lab and relying on detailed instructions; create the first two tables in the database;
use the experience gained in creating the first two tables to add the remaining tables;
using the model from Part A of the lab and relying on detailed instructions; create the relationship between the first two tables in the database; and
use the experience gained in creating the first relationship to create the remaining relationships between the tables.
D. Deliverables

Section

Deliverable

Points

Part A

YourNameLab2.vsdx (Visio Diagram)

Part B

YourNameLab2.accdb (Access Database)

E. Lab Steps

Preparation

Get the Visio diagram
Download Lab2_StarterFile.vsdx file from your course Lab page, and save the file to your local drive.
Using Citrix for MS Visio and/or MS Access
If you are using the Citrix remote lab, follow the login instructions located in the Lab area in the Introduction and Resources area.
You will have to upload the Lab2.vsdx file to your Citrix drive, or allow Citrix access to your system. Follow the instructions for uploading files to Citrix, located in the Lab area in the Introduction and Resources area.
Lab:

Part A: Create a Visio ERD with an Associative Entity

Step 1: Open the Lab2.vsdx file

Open the Lab2.vsdx file using Microsoft Office or Visio.
If you are using Citrix, click on Microsoft Office Applications folder to start Visio. Then use the File menu, open command to open the Lab2.vsdx file.
Step 2: Add two new entities and relationships to the Visio diagram.

The Lab2.vsdx file should open like the following screen. Using the Save As command in the Office Button list, save the file as YourNameLab2.vsdx.
Figure 2-a

The existing entities may be moved by clicking and dragging to create more room. You will be adding entities to the diagram, so drag a new entity shape to the page. You will need to click more shapes and go to Software? Database? Crow’s Feet. The menu to insert a table will pop up. You will name the new entity OrderLine, and add the following attributes.
OrdLineUnitPrice (required attribute)
OrdLineQuantity (required attribute)
OrdLineDiscount (not a required attribute)
NOTE: If you need assistance to do this, refer to the instructions for the Week 1 Lab.

Figure 2-b

Add a second new entity named orders with the following attributes so that your diagram matches the diagram below.
OrderID (primary key)
OrderDate (required)
OrderRequiredDate (required)
OrderShippedDate (not required)
OrderShipVia (not required)
OrderShipName (required)
OrderShipStreet (required)
OrderShipCity (required)
OrderShipState (required)
OrderShipZip (required)
Figure 2-c

At this point, the OrderLine table does not have a primary key. This is an associative entity and will borrow its primary key from the two parent tables. To add to the OrderLine entity, you must first add the set foreign key attribute of ProdID. Next, drag a relationship shape to the diagram. Connect the one end to the products entity and the other end to the OrderLine entity. Name the relationship specified by. Right click the attribute ProdID in the Orderline table and select foreign key, ProdID now appears in the OrderLine table as a foreign key. If you have trouble reading the relationship, drag and move the OrderLine table as shown below.
Figure 2-d

Add OrderID to the OrderLine table as an attribute. Right click and designate the attribute as a foreign key by clickiset foreign key. Drag a second relationship shape to the diagram. Connect the one end to the orders entity, and the many end to the OrderLine entity. Name the relationship included on. OrderID now appears in the OrderLine table as a foreign key. (NOTE: The page orientation in the diagram below has been changed to landscape. You will find the orientation options on the design ribbon.)
Figure 2-e

Save the file. If you are not going to continue to Part B of the lab, you may close the file.

End of Part A

Part B. Creating the Access Database (Tables and Relationships) from the ERD

Preparation

Open the Visio file created in Part A of this lab, you will reference this file in Part B.

Step 1: Locate MS Office Applications

If you are using Citrix, click on Microsoft Office Applications folder.
If you are using Access on a local computer, select Microsoft Office from your program menu.
Step 2: Start MS Access

Click on Microsoft Access and Microsoft Access should open like the following screen.
Figure 2-f

Step 3: Open a Blank Database

Click on the blank desktop database icon shown above in the top row. This will open a new database file. Please see the option to name your database and also select where it will be stored. It is important to both name your database and identify where it will be stored. In the file name text box, enter YourNameLab2, and then click the create button to begin working with your database.
Figure 2-g

The new database opens to a blank table in datasheet view as shown below. Click the view button on the left side of the ribbon to change to design view.
Figure 2-h

Notice that the Save As dialog box appears and you are asked to name the table. As you will create the suppliers table first, enter the table name suppliers and click the OK button to close the dialog box.
Figure 2-i

Step 4: Create the Tables

The design view opens with the cursor in the field name column. Notice the key symbol indicating that, unless you specify otherwise, this will be the primary key for the suppliers table. Referring to the ERD, enter the name of the suppliers table primary key, SupID. Use the dropdown arrow in the data type column to select the short tdata type as specified in the ERD. In the properties pane at the bottom of the window (There are two panes the table at the top and the properties at the bottom.), change the first property (field size) in the general tab to 10 so that the field size meets the requirements of our ERD diagram.
Figure 2-j

Add the SupCompanyName field name below SupID field name and add the corresponding data type, short text. In the lower properties pane, set the field length to 25, and change the required property to yes. Recall in the ERD that required fields are shown in bold font, so you can refer back to the bolded fields in your ERD.
Figure 2-k

Utilizing the Visio ERD, enter the remaining field/attribute names with corresponding data types and field properties. Once all fields are added, close the suppliers table by clicking the close button (x) on the right side of the design pane. You will be prompted to save changes, so be sure to save.
Figure 2-l

Please note that the data types are not on the Visio ERD. We have listed these here.
Suppliers Table

SupID—short text(10)
SupCompanyName—short text(25)
SupContactName—short text(25)
SupContactTitle—short text(25)
SupAddress—short text(20)
SupCity—short text(20)
SupRegion—short text(10)
SupPostalCode—short text(10)
SupCountry—short text(20)
SupPhone—short text(10)
SupFax—short text(10)
SupHomePage—hyperlink
Products Table

1.ProdID—short text(10)

2.ProdName—short text(25)

3.ProdDescription—long text

4.ProdUnitPrice—currency (2 decimals)

5.ProdQtyPerUnit—number (integer)

6.ProdUnitsInStock—number (integer)

7.ProdUnitsOnOrder—number (integer)

8.ProdReorderLevel—number (integer)

9.ProdDiscontinued—number (integer)

10.SupID—short text (10)

OrderLine Table

1.OrderLineUnitPrice—currency (2 decimals)

2.OrderLineQuantity—number (integer)

3.OrderLineDiscount—number (decimal)

4.ProdID—short text(10)

5.OrderID—short text(10)

Orders Table

1.OrderID — short text(10)

2.OrderDate—datetime

3.OrderRequiredDate—datetime

4.OrderShippedDate—datetime

5.OrderShipVia—short text(10)

6.OrderShipName—short text(25)

7.OrderShipStreet—short text(25)

8.OrderShipCity—short text(20)

9.OrderShipState—short text(2)

  1. OrderShipZip—short text(10)

Click on the create ribbon tab, and then on the table option on the left side of the ribbon. Access returns to the data view, and a new table is presented.
Figure 2-m

Access opens a new table in design view. When prompted for the table name, enter products. Using the information from the ERD, create the products table. Notice in the illustration below that the long text data type for the ProdDescription field is comparable to the access memo data type. The integer data type changes to number, and there is a yes/no option that is considered binary.
Figure 2-n

Repeat the process to create the remaining two tables from the ERD. When creating the OrderLine table, you will need to designate the composite primary key consisting of the ProdID and OrderID fields. To do so click and drag to select both rows in the design screen, and then click on the primary key button (picture of a key). On the ribbon shown below. Notice that the primary key designator now shows to the left of both field names. Set the OrdLine discount data type to number, the field to decimal, and the precision to 2.
Figure 2-0

After creating and closing the final table, click on the database tools ribbon, and then the relationships button. See below.
Figure 2-p

When the show table dialog box appears, drag it to the position shown below so that you can see the relationships work space. Click and drag to select all four tables and then click the add button. You should see all four tables in the relationship area. Close the show table dialog box.
Figure 2-q

Click the table name and drag the tables to positions corresponding to those on the ERD. Then, click the bottom border of each table object and drag it so that all fields on the table are visible.
Figure 2-r

Create a relationship between the suppliers and the products table. To do this, left-click and hold to drag and drop the primary field name of SupID in the supplier’s table to the SupID field in the products table. This will open the edit relationships dialog box. Make sure you show SupID in both tables as shown in the dialog box below. Click the checkbox for the enforce referential integrity option. Click the create button on the dialog box.
Figure 2-s

When the dialog box closes, you will see the relationship. Create the remaining relationships by dragging the primary key from the parent table to the corresponding fields in the associative table, OrderLine. Be sure to enforce referential integrity for all relationships, as this identifies the type of relationship for you. Your diagram should closely resemble the one below.
Figure 2-t

Save the database by clicking the save icon or by using the file menu, save command. Close the relationship diagram by clicking on the close button. Close the database and close Access. Congratulations on the successful creation of your database.
End of Part B

This question has been answered.

Get Answer