CCNC/CCNC Module 5/Designing and creating tables/Table Design and Layout/Adding Columns
Table Design and Layout |
Field Design and Properties | Adding Columns | Adding Indexes | Database Schemas | Self Assessment | Summary & FAQs |
Contents
Adding columns to a Table
Upon completion of this tutorial the learner will be able to:
|
Modifying a table
During the development of a database you will often come across the need to change a tables design. In this example we need to alter the 'PhoneNumber' tables design. It has become apparent that we need to separate out the area code from the phone number and we need to add a country code. This modification will allow us to more easily search on the area code and be able to filter on the country code.
Managing the change
When adding new fields to a table it may be identifed that some of the new fields should be mandatory (i.e. Entry required). This can cause problems when data already exists in the table for the new fields would not contain data. This is demonstrated when you try and save a table with a new field having the property of 'Entry required'. To make a field mandatory change its 'Entry Required' property to 'Yes'.
To fix the problem of a column constraint (not having data in a mandatory field) change the field to allow no data by changing the 'Entry Required' property to 'No'. Save the table.
Updating the data
Open the table and add data to the columns that will be mandatory. Close the table and re-open it in 'Edit' (design) mode and set the 'Entry Required' property back to 'Yes'.
Test your knowledge