The US Senate Database |
|
Planning
Introduction
This is one of the exercises intended to help you build some experience with databases and Microsoft Access. We are going to create a database that will need to be updated regularly, or at least whenever there is a new election or a new change in the US senate. Even if you don't live in the US, this exercise can help you with this type of application.
Valuable Information
To build this type of database, you should first design it. In this case, you can start by visiting the US Senate web site at http://www.senate.gov. From there, you can see that the primary list you will need to create is about senators. Therefore, you need to make a summary of the types of information you need about each senator. Valuable pieces of information include:
The Tables
General Tables
On a database, there are tables whose primary function is to provide fields to other tables. This reduces redundancy by allowing information to flow among objects and at the same time avoiding duplicate data. Such tables are create with regular fields and their cells receive direct input from the user. For our database, such table would include the gender, religion, marital status, etc. We will create most of these tables but we left some out. This could be an exercise for you to add any table we may have left out, such as one identifying the races of senators.
Field Name | Data Type | Additional Properties |
GenderID | AutoNumber | Primary Key Caption: Gender ID |
Gender | Text | Field Size: 20 |
Field Name | Data Type | Additional Properties |
PartyID | AutoNumber | Primary Key Caption: Party ID |
Party | Text | Field Size: 32 |
Description | Memo |
Field Name | Data Type | Additional Properties |
MaritalStatusID | AutoNumber | Primary Key Caption: Marital Status ID |
MaritalStatus | Text | Field Size: 20 Caption: Marital Status |
Description | Memo |
Marital Status ID | Marital Status | Notes |
1 | Single | This is for somebody who has never been married |
2 | Married | This is for somebody who is currently married |
3 | Divorced | |
4 | Widow | |
5 | Separated |
Field Name | Data Type | Additional Properties |
ReligionID | AutoNumber | Primary Key Caption: Religion ID |
Religion | Text | Field Size: 40 Default Value: "Unknown" |
Comments | Memo |
Field Name | Data Type | Additional Properties |
StateID | AutoNumber | Primary Key Caption: State ID |
State | Text | Field Size: 2 Input Mask: >LL Indexed: Yes (No Duplicates) |
StateName | Text | Caption: State Name Indexed: Yes (No Duplicates) |
State ID | State | State Name |
1 | AL | Alabama |
2 | AK | Alaska |
3 | AZ | Arizona |
4 | AR | Arkansas |
Field Name | Data Type | Additional Properties |
CommitteeID | AutoNumber | Primary Key Caption: Committee ID |
Committee | Text | |
Description | Memo |
Committee ID | Committee | Description |
1 | Agriculture, Nutrition, and Forestry | |
2 | Appropriations | |
3 | Armed Forces | |
4 | Banking, Housing, and Urban Affairs |
Field Name | Data Type | Description | Additional Properties |
CMStatusID | AutoNumber | Committee Membership Status ID | Primary Key Caption: CMStatus ID |
CMStatus | Text | Committee Membership Status | Field Size: 30 |
Field Name | Data Type | Description | Additional Properties |
SCMStatusID | AutoNumber | Subcommittee Membership Status ID | Primary Key Caption: SCMStatus ID |
SCMStatus | Text | Subcommittee Membership Status | Field Size: 30 |
Relations-Based Tables
After creating general tables, you can create those whose information can be provided by those primary tables. For example, some of the tables we have created involve simple information such as gender or religion. The reason we created their own tables was to reduce the likelihood of the user trying to provide the same information but typing it differently for two records. For example, imagine two female senators for whom the user enters the gender of one as Female and the other as F or even Girl. As far as the database is concerned, these would be two different values.
Field Name | Data Type | Additional Properties |
SenatorID | AutoNumber | Primary Key Caption: Senator ID |
FirstName | Text | Field Size: 20 Caption: First Name |
MiddleName | Text | Field Size: 20 Caption: Middle Name |
LastName | Text | Field Size: 20 Caption: Last Name |
PartyID | Number | Field Size: Long Integer Caption: Party Default Value: None |
StateID | Number | Field Size: Long Integer Caption: State Default Value: None |
WebSite | Hyperlink | Caption: Web Site |
YearElected | Number | Field Size: Integer Caption: Year Elected Default Value: None |
GenderID | Number | Field Size: Long Integer Caption: Gender Default Value: None |
OfficeAddress | Text | Field Size: 240 Caption: Office Address Default Value: "000 Hart Senate Office Building, Washington DC 20510" |
OfficePhone | Text | Field Size: 20 Input Mask:!\(999") "000\-0000;0;_ Caption: Office Phone Default Value: " (202) 224-0000" |
OfficeFax | Text | Field Size: 20 Input Mask:!\(999") "000\-0000;0;_ Caption: Office Fax |
HomeStateAddress1 | Text | Field Size: 240 Caption: Home State Address 1 |
HomeStatePhone1 | Text | Field Size: 20 Caption: Home State Phone 1 Input Mask:!\(999") "000\-0000;0;_ |
HomeStateFax1 | Text | Field Size: 20 Caption: Home State Fax 1 Input Mask:!\(999") "000\-0000;0;_ |
HomeStateAddress2 | Text | Field Size: 240 Caption: Home State Address 2 |
HomeStatePhone2 | Text | Field Size: 20 Caption: Home State Phone 2 Input Mask:!\(999") "000\-0000;0;_ |
HomeStateFax2 | Text | Field Size: 20 Caption: Home State Fax 2 Input Mask:!\(999") "000\-0000;0;_ |
HomeStateAddress3 | Text | Field Size: 240 Caption: Home State Address 3 |
HomeStatePhone3 | Text | Field Size: 20 Caption: Home State Phone 3 Input Mask:!\(999") "000\-0000;0;_ |
HomeStateFax3 | Text | Field Size: 20 Caption: Home State Fax 3 Input Mask:!\(999") "000\-0000;0;_ |
HomeStateAddress4 |
Field Size: 240 Caption: Home State Address 4 |
|
HomeStatePhone4 |
Field Size: 20 Caption: Home State Phone 4 Input Mask:!\(999") "000\-0000;0;_ |
|
HomeStateFax4 |
Field Size: 20 Caption: Home State Fax 4 Input Mask:!\(999") "000\-0000;0;_ |
|
HomeStateAddress5 |
Field Size: 240 Caption: Home State Address 5 |
|
HomeStatePhone5 |
Field Size: 20 Caption: Home State Phone 5 Input Mask:!\(999") "000\-0000;0;_ |
|
HomeStateFax5 |
Field Size: 20 Caption: Home State Fax 5 Input Mask:!\(999") "000\-0000;0;_ |
|
MaritalStatusID | Number |
Caption: Marital Status Default Value: None |
NumberOfChildren | Number | Field Size: Byte Caption: Nbr of Children |
ReligionID | Number | Caption: Religion Default Value: None |
Picture | OLE Object | |
CurrentlyActive | Yes/No | Caption: Is Currently Active? Default Value: 1 Lookup -> Display Control: Combo Box |
Notes | Memo |
Field Name | Data Type | Additional Properties |
SubcommitteeID | AutoNumber | Primary Key Caption: Subcommittee ID |
CommitteeID | Number |
Caption: Committee Default Value: None |
Subcommittee | Text | |
Description | Memo |
Field Name | Data Type | Additional Properties |
CommitteeMembershipID | AutoNumber | Primary Key Caption: Committee Membership ID |
CommitteeID | Number |
Caption: Committee Default Value: None |
SenatorID | Number |
Caption: Senator Default Value: None |
CMStatusID | Number |
Caption: CMStatus Default Value: None |
Field Name | Data Type | Additional Properties |
SubommitteeMembershipID | AutoNumber | Primary Key Caption: Subcommittee Membership ID |
SubcommitteeID | Number | Field Size: Long Integer Caption: Subcommittee Default Value: None |
SenatorID | Number | Field Size: Long Integer Caption: Senator Default Value: None |
SCMStatusID | Number | Field Size: Long Integer Caption: SCMStatus Default Value: None |
Relationships Management
Although you can completely create the tables relationships in the Design View of a table, Microsoft Access provides a specific window to manage them. The Relationships window allows you to specify or modify the direction of a relationship. Also, in case you didn't use the Lookup Column or the Lookup Wizard when creating the table, as we have done so far, you can use the Relationships window to actually create the relationships.
You may have realized that, for some strange reason, we avoided using a wizard to create the relationships among our tables. There is no specific reason except that it allowed us to give less instructions. On our own defense, we would state that, since most database environments, including Microsoft SQL Server and Borland/Corel Paradox don't use the wizard, we are not doing anything worse. Therefore, we will create and manage all of our relationships using the Relationships window.
|
||
Home | Next | |
|