Hi Drew:

Could you please comment on this text? Particularly if something is wrong or 
incomplete.
Thanks!

Mariano

On table attributes of not null, unique and key

Base allows you to specify certain attributes for the columns in your tables. 
In this tutorial we will consider the following options:

Key: This option tells Base that this column will hold the primary key of the 
table. Base will prepare then to see it associated with other tables.

Unique: When you specify this option, Base will make sure that records in this 
column are not repeated. If, for example, you specify that the 'surname' column 
be unique, then the second time you try to enter 'Dumas' Base will reject it as 
 an invalid entry. It makes a lot of sense to make sure that a column set to 
KEY is also set to UNIQUE.

Not null: This option means that records can not be left with this attribute 
empty. Base will display an error message if you try to enter a record that 
leaves a NO NULL column empty. This forces whomever is using your database to 
at least have the information requested in the NOT NULL columns if they want to 
entrer the record. For example, if you set the 'surname' and 'date of birth' as 
NOT NULL, then a user can not input a new author if he doesn't have at least 
the surname and the date of birth. Again, it  makes sense that Key columns are 
also set to NOT NULL.

On the different deletion options and what they mean.

Because being able to relate the object in one class to another object in 
another class is so important, and the strength of relational databases, 
special care must be placed on the subject or deleting records. Think about 
this: Let's say that there is an an author that wrote only one book and you 
discover that you no longer have that book in your collection. As you update 
your database and erase that title, what will happen to the 'author' 
information? Should it be deleted too? Should it be kept as an historical 
record or in case you find and buy that book again?

Actually, both options are valid and you can chose the one that reflects the 
purpose of your database best. But your application will not know what to do 
unless you make explicit what your preference is. For this reason, when you are 
developing your application and defining relationships, Base will ask you how 
to handle the deletion of records and will offer you the following options. 
This is what they mean:

No action: Base will not delete the record but...

Delete Cascade: With this option, Base will delete the record you are 
requesting to delete and will also delete all other records that have the 
deleted record's key as a foreign key. This option is called cascade because it 
elicits the image of a deletion creating further deletions. 

Set Null: With this option, Base will delete the record you are requesting but 
will not delete the others related to it. Instead it will erase their foreign 
keys to reflect that they are no longer associated. Note that this requires 
that NUT NULL is not a condition of the foreign key column.

Set Default: When deleting an object, the foreign key column of the associated 
tables will be populated with a default parameter that you previously specified.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to