Upload
others
View
0
Download
0
Embed Size (px)
Citation preview
Lesson 16 | Slide:1 of 16 Acc
Table Design - II
Lesson
Lesson 16 | Slide:2 of 16 Acc
Content
In this lesson you will :-
Discuss the issues related to table design
modifications
Discuss what is field deletion and insertions
Explain the impact of changing the Primary key and
data type
Discussion what is copy and deletion of tables
Lesson 16 | Slide:3 of 16 Acc
Table Design Modifications
Modifying design of a table comes with its own set of
restrictions and therefore it is of great importance to design the
table structure in detail and to stabilize the table structure to
minimize the chances of design modifications.
This lesson discusses table modifications limited to following
aspects only:
Changing table name
Changing the primary key
Changing field data type
Deletion or insertion of fields
Changing order of fields
Lesson 16 | Slide:4 of 16 Acc
Changing Table Name
Right-click the table on the Navigation Pane and select the Rename option.
Or as a shortcut, you can Press F2 on the selected table to rename it.
Lesson 16 | Slide:5 of 16 Acc
Changing Primary Key
Before changing the primary key of a table having
records, ensure that:
The field is not having duplicate values
The field is not empty
You can change easily change primary key of an
empty table.
Primary Key of a table should be rarely changed
Lesson 16 | Slide:6 of 16 Acc
Changing Field Data Type
Consider following aspects while modifying field’s data type or field size having existing values:
The new data type can support old values. Changing Number to Text is possible since all Numbers values
are accepted by Text.
Changing Text to Number may not be possible since all Text values are not supported by Number.
Old values can fit in the new field size. if you change a field with data type Text and field size 10 to field
size of 5, the existing field values will be lost.
Access displays warning messages when there is a conflict during data type change or field size change
Lesson 16 | Slide:7 of 16 Acc
Adding a New Field
You can add new field to an existing table structure by
defining an additional field after the last existing field.
You can also add or insert a new field in between
existing fields by right-clicking on the table structure
and then selecting the insert row option.
You will need to enter values for the new field for each
existing record.
Lesson 16 | Slide:8 of 16 Acc
Deleting a Field
You can easily delete a field by selecting the field
followed by using the delete button.
You can also delete a field by right-clicking on the field
and then selecting the Delete Rows option.
Remember that the field values for each record are
permanently lost once a field is deleted.
Lesson 16 | Slide:9 of 16 Acc
Adding, Deleting a Field
Click on Insert
Rows to add field
Click on Delete Rows
to remove field
Lesson 16 | Slide:10 of 16 Acc
Changing Order of Fields
To change the order of a field, select the field and then drag and drop before or after the desired field.
Note that changing the order of fields does not lead to any loss of data.
Lesson 16 | Slide:11 of 16 Acc
Deleting Table
You can delete a table by selecting the table on the
Navigation pane and ten pressing the delete key.
A table can also be deleted by right-clicking on the
table and then selecting the delete option.
Deleting a table permanently deletes the table
structure and its records.
Lesson 16 | Slide:12 of 16 Acc
Copying Table
You can copy a table in the following three different
manners:
Copying Structure only: You only copy the structure of
the table but not its records.
Copying Structure and Data: You copy both the table
structure as well as the table records.
Append Data to Existing table: You add the records of a
table to an existing table. For this option to work, the table
structure of the destination table must be identical as that
of the source table.
Lesson 16 | Slide:13 of 16 Acc
Copying Table
Lesson 16 | Slide:14 of 16 Acc
Table Modification Tips
Carefully design the table structure. Stabilize the
structure before inserting records
Avoid changing primary key
During changing field’s data type ensure that existing
values can be supported
Always keep a copy of original table and its records
Lesson 16 | Slide:15 of 16 Acc
Wrap-up
Access does not allow a field to be assigned as a primary key if it contains duplicate values.
During table design modifications, you can either change the data type of a field or change its field size.
Changing a field size from a larger size to a smaller size may lead to loss of data in the existing field values.
Deleting a field leads to a permanent loss of field values.
Access allows you to change the order of the fields in a table structure.
You can copy the table structure, or table structure and data or only data to an existing table.
Lesson 16 | Slide:16 of 16 Acc
End of Lesson 16