Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
bilety_inform_1 (1).doc
Скачиваний:
0
Добавлен:
03.08.2019
Размер:
449.54 Кб
Скачать

Specifying Field Data Types

The kind of values you plan to allow in the field and how you plan to use them.

The availability of storage space. With some data types, the field size can be reduced for efficiency.

The types of operations you can execute with the data. You can count the number of records containing a specific value of most data types in a field, but you can perform mathematical operations on values only in the Number and Currency fields.

The way you want to sort records. You can sort any field data type except OLE Object and Attachment.

The way you want to group records for a report or query. You can group on any field data type except Memo, Hyperlink, OLE Object and Attachment.

14. CREATING TABLES

You can create it:

  • From a template;In Datasheet view;In Design view.

A new table opens in Datasheet view in the object pane with two fields showing:

  • ID the automatic primary key field.

  • (Add New Field) Where you begin entering data.

Default data types

As you enter data in each new field, Access chooses the appropriate data type for the field, such as Text, Number, or Date / Time. For example:

  • Anna Petrova becomes a Text data type.

  • 01/05/2010 becomes a Date /Time data type.

  • 76.63 becomes a General Number data type, with Double field size property because of the digits to the right of the decimal point.

  • $65, 000.00 becomes a Currency data type.

  1. The easiest way to start a new table is to click the Table Design command in the Tables group on the Create tab. An empty table appears in the Design window, ready to add fields. The Design tab in the Table Tools ribbon appears.

Choosing a Primary Key

In a relational database system, to gather and retrieve related information from separate tables in the database, each record in one table must be unique in some way. The field or fields that contain the unique value is called the primary key.

Access never permits duplicate values in the primary key nor does it permit null values.

A valid unique value must be in the primary key field or field combination throughout the table. In Design view, you can tell which field contains the primary key by the key icon that appears in the left margin.

16. RELATING TABLES

  • The advantages of relating tables in a database are many. For example:

  • information retrieval routines operate much faster with matched fields, and errors are less likely to be introduced into the database during data entry.

  • Tables related at the table level in the Relationships window are ready for use in queries, forms, and reports.

  • When tables are related, you can add a subform or subreport that includes corresponding information from the related table.

  • Relating tables also helps maintain data integrity and cohesiveness.

Enforcing Referential Integrity

When you want Access to enforce the referential integrity rules on the relationship that you are defining, check Enforce Referential Integrity in Edit Relationships dialog box.

If, for some reasons, the tables already violate one of the rules, such as the related fields not being of the same data type, Access displays a message explaining the violation and does not apply the enforcement. two options become available :

  • The Cascade Update Related Fields option

  • The Cascade Delete Related Records option

The Cascade Update Related Fields option

lets you change the value in the primary key field in the parent table, and Access automatically changes the foreign key value in the child table to match.

This option preserves the relationship.

If the primary key in a table serves as a link to more than one table, you must set the Cascade Update Related Fields property for each of the relationships.

If not, Access displays a message that referential integrity rules would be violated by the cascading operation and refuses to delete or update the record.

The Cascade Delete Related Records option

enables you to delete a parent record, and then Access automatically deletes all the related child records.

When you try to delete a record from the parent table of a relationship with this option selected, Access warns you that this record and the ones in the related tables will be deleted.

For example, if you delete an employee record, Access automatically deletes all the records for that employee in the related tables.

So, setting this property can be dangerous. If you delete records using a Delete query, access automatically deletes the related records without issuing a warning.

17. SORT & FILTER

The Access Sort and Filter features help you do that. Sorting arranges the records in a specified order, while filtering hides records you do not want to see. Combining these two tools gives you the power to display only the records you want in the order you want.

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]