MACROMEDIA COLDFUSION MX 61-CFML Informations techniques Page 45

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 152
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 44
Exercise 3: Designing the database for your application 45
Establishing a relationship between the two tables
When the user selects an event type from the list obtained from reading the eventtypes table, the
correct event type must be saved to the trips table with all the other trip-related data. The
application could store the eventType (for example, mountain climbing) itself into the eventType
column in the trips table. But if the name Mountain Climbing were later shortened to Climbing
in the eventtypes table, new mountain climbing trips would be classified differently than ones
saved before the change. For this reason and to save space in the database, the key to the
eventtypes row (eventTypeID) is stored in the trips table instead.
The two tables are said to have a relationship. This relationship works by matching data in key
fields. In this case, the matching fields consist of a primary key (eventTypeID) from the eventtypes
table, which provides a unique identifier for each record, and a foreign key (eventType) in the trips
table. The foreign key contains the same value as the primary key, pointing to a unique event
type. The following figure shows this relationship:
Vue de la page 44
1 2 ... 40 41 42 43 44 45 46 47 48 49 50 ... 151 152

Commentaires sur ces manuels

Pas de commentaire