CCNC/CCNC Module 5/Designing and creating tables/Basic Table Operations/Edit A Table

From WikiEducator
Jump to: navigation, search
Tutorial.png Basic Table Operations 

Creating a Table | Design a Table | Open a Table | Add Records | Edit a Table | Navigate a Table | Close a Table | Delete a Table | Self Assessment | Summary & FAQs


Editing a table design

Icon objectives.jpg

Outcomes

Upon completion of this tutorial the learner will be able to:
  • Identify and use three different methods to edit a table
  • Make changes to an existing table
  • Explain data related issues when changing a table design
  • Manage the design changes to ensure design properties are enforced


Editing a Table

Once you have created a table you may find that you wish to add another field at a later stage. This you do by right-clicking on the table name and choosing Edit. If you want the field at the end then simply click in the row underneath the last field and enter the new field. Click on the Save button to save the change. If you forget to save the table you will prompted to do so when you close it.

If you want the new field to appear within the current fields, ie not at the end, then click on the grey button to the left of the field that you want to be after the new field and right click. A pop up menu will appear allowing you to choose to insert rows. Click on Insert Rows and you have a new row in which to enter your field.

As with many tasks within OpenOffice Base there are many ways to do the same task. When editing an existing table to change its design you could choose any of the following methods;

Menu

Figure 1. Method One: Menu

A table can be opened for editing by highlighting the table to edit and using the Edit menu and select Edit...

Toolbar

Figure 2. Method Two: Toolbar
Figure 3. Viewing the Toolbar

You can also open a table for editing by highlighting the table and selecting the Edit button from the toolbar. (Figure 2.)

Remember: to turn on the table toolbar select the View menu and then Toolbars and Table.

Right Click

Figure 4. Method Three: Right Click

Another method is to right-click on the table for editing and select Edit from the pop-up menu.

Making Changes

Making changes to an existing table can be a challenge for a table may already contain data or the table may have foreign key dependencies. Making changes can violate the tables existing data integrity rules. If the changes to be made do violate these existing rules this will often mean that the table will have to be changed in a multi-step process with accompanying data management tasks.

Editing

Figure 5. Open for editing

Open an existing table (that already contains data) so it can be Edited. Add another field to the table design and set the 'Entry Required' property to 'Yes'. In our example we have opened the 'People' table and added a 'nationality' field. Once the changes have been made, save the table.

Figure 6. Required Error

An error message is presented to us for we have violated the 'Entry Required' rule. When the database tried to save the table it attempted to apply all the rules to the data in the table. The 'Entry Required' rule on the 'nationality' field (or column) would have been in violation for their is NO data in this new field.

(Comment.gif: Column is another name for field or attribute;

  • Column is another name for a field or attribute. The difference being is column is referred to when the table is open for adding or viewing the data. Its like the column of a spreadsheet.

)

Figure 7. Save

To fix this problem we open the table is design mode and change the 'Entry Required' property on the 'nationality' field to 'No'. We save the table and this time we get no error for their is no rule being violated.

Adding data to the new column

Figure 8. Adding data

We then add data values to ALL the fields in the new 'nationality' column. Close the table.

Figure 9. Set the column properties

We re-open the table in design and then set the 'Entry Required' property to 'Yes'. When we again save the table with this new rule we do not get an error for the 'nationality' column contains data.

Test your knowledge



Icon qmark.gif

Editing a tables design

 

1. Their is more than one way to open a table for design?

TRUE
Absolutely Correct!
FALSE
Incorrect, there are three ways. Click here to review the topic..

2. Toolbars are configured (turned on and off) before you run OpenOffice?

TRUE
Incorrect, you can turn them on and off from the view menu. Click here to review the topic.
FALSE
Absolutely Correct!

3. The data that already exists in a table needs to follow the new rules when making design changes to the table?

TRUE
Absolutely Correct!
FALSE
Incorrect, the data cannot violate any new table rules. Click here to review the topic.

Your score is 0 / 0