CCNC/CCNC Module 5/Designing and creating tables/Table Design and Layout
|Table Design and Layout|
Field Design and Modification
Exploring the data types
It's a good idea to familiarize yourself with all the different data types available when adding fields to a table. The table displayed here provides an implementation of many of the data types. Once you have added the different fields, click on each one and view the fields properties. Feel free to play around and get a sense of the differences and similarities among the different data types.
Modifying a fields properties
When you create the fields you will notice the field properties section at the bottom of the screen that allows you to change the field properties such as the size of the field, the number and date format, etc. To change these attributes you will need to click on the field at the top which will give you access to it's properties displayed in the bottom section of the screen.
To change the field size click on the field to select it. A green arrow will appear to indicate that it has been selected. Then click in the white box next to Length. Type in the number of characters you want the field to be restricted to.
If you want to change the number or date format click on the grey button next to Format example. This will bring up a dialog box which will allow you to choose a format for the number or date.
Consequences of change
It is important to note that if you change the field size in a table and there is already data in the table you may lose some of that data. For example, if you change a field size from 50 characters long to 10 characters long and there is a record that already contains 20 characters in that particular field you will lose (or truncate) the data; so be very careful.
Moving the columns within a table
Being able to re-order the fields or columns within a table is a useful feature. This feature is only available when you are first designing the table. Once the table has been saved the field order is also dependent on the data stored in the table. Changing the order of the fields would also mean the database would have to re-order the data. The data re-organization would have dependencies on the tables rules, therefore making it a complicated process. This re-ordering should be done with careful consideration and with the assistance of a database administrator so no data is lost.
Widening the columns
Sometimes the columns containing the fields are not wide enough to display the data fully. You can widen the columns by opening the table. Click on the table, right click and select Open from the pop-up menu. Move your mouse up between the field names in the grey area (as you would to widen columns in a spreadsheet), double click on the vertical line separator. Another method to change the columns width is to place the mouse between the field names, hold down the left mouse button and drag the column width to be wider or narrower.
Test your knowledge