Ennis-Cole, AC 2.01, CECS Maintaining A Database By: Dr. Ennis-Cole
Ennis-Cole, AC 2.01, CECS OBJECTIVES: Learn the guidelines for designing databases and Access tables Create and Save a table Define fields and specify the primary key Add records to a table Modify the structure of a table Delete, move, and add fields
Ennis-Cole, AC 2.01, CECS OBJECTIVES: Change field properties Copy a record from another Access database Delete and change records
Ennis-Cole, AC 2.01, CECS Guidelines for Designing Databases: Identify all the fields needed to produce the required information Group related fields into tables Determine each table’s Primary key Include a common field in related tables Avoid data redundancy Determine the properties of each field
Ennis-Cole, AC 2.01, CECS Naming Fields and Objects in Access Tables Fields can be 64-characters long Fields can contain letters, numbers, and special characters; the first letter must be capitalized Fields cannot contain., !, ‘, “ ”,and [] A table or query name must be unique Extremely long names should be avoided Standard abbreviations should be used
Ennis-Cole, AC 2.01, CECS Data Types: You must assign a data type for each field It determines what field values you can enter for the field The field size defines a field value’s maximum storage size for text, numbers, and AutoNumber fields Refer to Fig 2-4
Ennis-Cole, AC 2.01, CECS Field Size Settings for Numeric Fields: Byte - stores whole numbers from in one byte Integer - stores whole numbers from -32,768 to 32,767 in two bytes Long Integer(default) - stores whole numbers from -2,147,483,648 to 2,147,483,647 in four bytes Single - stores positive and negative numbers to precisely 7 decimal places & uses 4 bytes
Ennis-Cole, AC 2.01, CECS Field Size Settings for Numeric Fields: Double - stores positive and negative numbers to precisely 15 decimal places and uses 8 bytes Replication ID - establishes a unique identifier for the replication of tables, records, and other objects, uses 16 bytes Decimal: stores positive and negative numbers to precisely 28 decimal places and uses 12 bytes
Ennis-Cole, AC 2.01, CECS Creating a Table: Consists of naming the fields and defining the field’s properties Specify a primary key, save the table structure Start Access, open an existing file Click Look in list arrow, open the database Click New and Design View, Click OK
Ennis-Cole, AC 2.01, CECS Defining a Field in a Table: Select the table, click the Design Button Type the field name Select the data type Type or select other field properties Refer to Figs. 2-8 through 2-13 for details
Ennis-Cole, AC 2.01, CECS Specifying a Primary Key In the table window in Design View, click the row selector for the field to be the primary key If primary key consists of two or more fields, press and hold down the Ctrl key Click the row selector for each field Click the Primary Key Button
Ennis-Cole, AC 2.01, CECS Saving a Table Structure: Click the Save button on the Table Design Toolbar Type the name of the table in the Save As Dialog Box Click OK Refer to Figs.2-17 through 2-19 for information on adding records to a table
Ennis-Cole, AC 2.01, CECS Modifying the Structure of An Access Table: Delete a Field Move a Field Add a Field Change Field Properties Change the Format Property Reference pp. AC
Ennis-Cole, AC 2.01, CECS Copying Records from Another Access Table: Open the database Click the appropriate table name & click open Click row selector, click copy button - All the records are copied to Clipboard Click Close, Click Yes and the Close button Click File, Table name, and click row selector Click Paste button, Click Yes to paste all the records
Ennis-Cole, AC 2.01, CECS Updating a Database: Click Delete record button on the Table Datasheet toolbar Click Yes to Delete a record The F2 key is a toggle to switch between navigation and editing modes: In navigation mode, an entire field value is selected In edit mode, you can insert or delete characters in a field value based on the location of the Insertion Point Refer to Fig. 2-31
Ennis-Cole, AC 2.01, CECS The Access RDBM Your Turn !!!