Annex I: Understanding Relationships Sample Area 1 Sample Area 2

advertisement
Annex I: Understanding Relationships
Sample Area 1
Sample Area 2
Sample areas 1 and 2 each contain three plots. A simple relational database could be
designed to record information on the two sample areas and six plots.
Sample Area table
Plot Description table
SampleAreaID
Shape
Color
SampleAreaID
PlotID
Size
Pattern
1
Circle
Gray
1
1
Small
Diagonal
2
Square
Black
1
2
Medium None
1
3
Large
Checkered
2
4
Large
Checkered
2
5
Small
Striped
2
6
Medium Dots
The relationship linking the two tables is the SampleAreaID field. Instead of repeating
the Shape and Color of the sample area for each entry in the Plot Description table, two
tables are created. The SampleAreaID column in the Plot Description table is a reference
to the SampleAreaID in the Sample Area table allowing for a link between the two tables.
37
Annex II: Database Structure
A) PLEC Agrobiodiversity Database Structure (utility table omitted):
SampleAreaDescription
ClusterName
Country/Subcluster
GroupName
DemoSite
SampleAreaLocation
SampleAreaID
LandUseStage
FieldType
Date
Researcher
Farmer
Notes
PlotDescription
SampleAreaID
PlotID
PlotSize
LandTenure
ResourceTenure
Elevation
Steepness
Aspect
SoilType
MoistureStatus
Date
Researcher
Farmer
Notes
SpeciesData
PlotID
SpeciesID
Abundance
Utility
Date
Researcher
Farmer
Notes
ID
SpeciesList
ScientificName
CommonName
SpeciesID
TreeData
PlotID
TreeTagNumber
SpeciesID
DBH
Height
Researcher
Farmer
Date
Notes
B) Sample Yunnan Database Structure (does not include all tables):
CommunityDescription
CommunityID
County
Population
Area
Swidden(area)
Paddy(area)
Rubber(area)
PassionFruit(area)
Cardamom(area)
Housegarden(area)
FuelLot(area)
CommunityForest(area)
HouseholdDesc.
Family
CommunityID
HouseholdID
ActiveMales
ActiveFemales
DependantMales
DependFemales
FulltimeFarmers
BuildingSize
AgeOfHead
Education
Income
Credit
Tenure
YearsInRegion
SampleArea
HouseholdID
SampleAreaID
LUS
FieldType
Area
Elevation
Steepness
Aspect
MoistureStatus
Date
SpeciesList
SpeciesID
LocalName
ChineseName
ScientificName
SpeciesData
SpeciesID
SamAreaID
Abundance
Utility
Management
SampleAreaID
Pruning
Clearing
Thinning
Interplanting
Hunting
Timber
Terrace
38
Annex III: Data Types and Primary Keys
SampleAreaNumber is the
Primary Key for this table.
The column must contain
whole numbers and each
row must contain a unique
number.
The SampleAreaNumber in
this table must reference one
of the Sample Area Numbers
entered in the SampleAreas
Table.
Most of the columns in this table are text,
meaning the column will accept words or letters.
It will also accept numbers, but the program does
not recognize a number as a value if it is in a text
column.
The date column accepts dates in a variety of
formats. It is set to display dates in the “ddMonth-yy” format.
The PlotNumber column is the Primary Key for
this table. It must contain a unique whole
number for each row.
The Elevation and Steepness
columns can contain any
rational number. They
cannot hold text.
The ID field in this table is the
Primary Key. It automatically
creates a unique number for
each row.
The Species ID is linked to
the SpeciesList Table. Since
each species has its own
unique number, the whole
number entered into this field
represents a single species.
The PlotNumber in this table must reference one
of the Plot Numbers entered in the
PlotDescription Table.
The Abundance column must be a whole number.
39
The SpeciesID is the Primary
Key for this table. It must be a
whole number and unique for
each species
The SpeciesID column in this
table is linked to the SpeciesList
table. Each number entered into
the column presents a species in
the SpeciesList Table
The ID column in this table is the
primary key and it is
automatically generated.
Most of the utilities are yes or no
fields and only yes or no can be
entered into these fields. In the
spreadsheet these fields appear as
boxes. A box with a check
means yes.
This is the only table that contains the
local and scientific names of species. All
other tables should use the SpeciesID
number and be linked to this table.
The PlotID column is linked to the
PlotNumber column in the PlotDescription
table. Every row in this table should
reference the PlotNumber the tree is
located in.
The TreeTagNumber is the Primary Key for
this table. Each tree entered into this table
must have a unique value in this column.
The PlotNumber column in this table is
linked to the PlotNumber column in the
PlotDescription table. Every row in this
table should reference the PlotNumber the
plant is located in.
The SpeciesID column in this table is
linked to the SpeciesList table. Each
number entered into the column presents a
species in the SpeciesList Table
40
Annex IV: Potential Errors
Wrong data type
This error will appear if you attempt to paste data into a
field that is not the correct data type. The most common
error is pasting text in a number field (e.g. 19a). Also, if
the columns are not in the same order as the Access table,
this message will most likely appear. All errors will be
imported to a new table called “Paste Errors.” Open the
past errors table, match the data types, and then re-paste
the edited errors into the table.
Duplicate Primary Key
Each table must have a column with a unique number in
every row. In the Plot Descriptions and Sample Area
tables the primary keys are SampleAreaID and PlotID,
respectively. These entries must have unique whole
numbers. Any errors will be imported into a table called
“Paste Errors.” Edit the errors in the Paste Errors table
then copy and re-paste the edited data back into the table.
41
Related Record Required
This error occurs when a sample area or plot number
is referenced and there is no record of the number in
the more general table. For instance, if there are
only 2 sample areas entered into the database, the
number 3 in cannot be used to reference the Sample
Area table because there is no record with that
sample area number in the Sample Area table. For
this reason, when pasting tables into Access, start
with the most general tables and end with the most
specific.
43
Download