Documente Academic
Documente Profesional
Documente Cultură
Databases
Chapter 9
Asfia Rahman
2 Key terms
Database: a structured method of storing data
Table: a set of similar data (about people, places, objects or
Record: a common word for entity
Entity: a set of data about one thing (person, place, object or event)
Attribute: a category of information within an entity
Field: a common word for attribute
Primary key: a field that contains the unique identifier for a record Database management system: software
used to manage a database
Relationship: the way in which two entities in two different tables are connected
Foreign key: a field in a table that refers to the primary key in another table
Normal form: the extent to which a database has been normalised Index: a list of keys or keywords which
identify a unique record and can be used to search and sort records more quickly
Entity relationship diagram: a diagram that represents the relationships between entities
Flat file: a database stored in a single table
Compound key: two or more fields that form the primary key Referential integrity: data in the foreign key of the
table on the many side of a relationship must exist in the primary key of the table on the one side of a
relationship
Query: a question used to retrieve data from a database
Parameter: data used within the criteria for a query
Asfia Rahman
3
Field
Value/Data Value of the field
Asfia Rahman
4 Keys
Asfia Rahman
5 RDBMS
DBMS
Database management system – Software used to manage a database.
RSBMS
Relational Database management system – Software used to manage a
database that includes relationships.
Asfia Rahman
6 Field types and sizes
Asfia Rahman
7 Field sizes
Fields within a table will have field sizes applied to them. This is because most fields are a
fixed length. This means that only a specified amount of data can be stored in each field.
Text and alphanumeric fields will have a length to specify the maximum number of
characters that can be stored. For example, the Product Name in the Product table is limited
to 40 characters. This avoids having lots of wasted storage space where field space is not
used up if the length is too long.
Numbers can also have a field size. This could be defined as the number of digits or it could
be defined as the maximum numeric value.
Dates will always be the same field size as they will always store the date in the same way,
but they can be formatted to be displayed differently.
Some text fields can be formatted to be a variable length which means they can store as
little or as much data as possible. These are sometimes referred to as memo or long text data
types. These are useful for fields that will contain notes or comments.
Asfia Rahman
TIP: Use the Long Integer data type when you create a
foreign key to relate a field to another table's AutoNumber
primary key field.
Byte — For integers that range from 0 to 255. Storage requirement is a single
byte.
Integer — For integers that range from -32,768 to +32,767. Storage requirement is
two bytes.
Long Integer — For integers that range from -2,147,483,648 to +2,147,483,647.
Storage requirement is four bytes.
Single — For numeric floating point values that range from -3.4 x 1038 to +3.4 x
1038 and up to seven significant digits. Storage requirement is four bytes.
Double — For numeric floating point values that range from -1.797 x 10308 to
+1.797 x 10308 and up to 15 significant digits. Storage requirement is eight bytes.
Decimal — For numeric values that range from -9.999... x 1027 to +9.999... x 1027.
Storage requirement is 12 bytes.
Asfia Rahman
9 ERD
Many to Many
Order Product
Asfia Rahman
10 Erd tasks
Asfia Rahman
11 Erd tasks
Husband Wife
Describe each of the
relationships
Club member Exclusive member
Book Author
Booking Room
Car Service
Asfia Rahman
12 relationships
Asfia Rahman
13 Creating relationship on access
Table A Table B
Asfia Rahman
14 One to one
Club Exclusive
member member
Asfia Rahman
15 One to one in access
Asfia Rahman
Step 2:
16
Click and
drag the PK
Step 1: Make sure that to FK.
foreign ley filed is indexed Make sure to
to NO DUPLICATES CHECK
“referential
integrity
Asfia Rahman
17 One to many
When each record in one table can connect to many (zero or more)
records in another table
FK will exist within the table on many side of relationship. It will connect to
PK in the one side of relationship.
Table B
Table A
FK
PK
(many
(one side)
side)
Asfia Rahman
18 One to many in access
Asfia Rahman
19
Asfia Rahman
20
Asfia Rahman
21 many to many
Table A Table B
Asfia Rahman
22 example
Asfia Rahman
23 many to many in access
Asfia Rahman
24 One to many task
Asfia Rahman
25 Many to many questions
Asfia Rahman
26 Referential integrity
Exists when data in the foreign key of the table on the many side of a
relationship exists in the PK of the table on the one side of a relationship
Without referential integrity a relationship cannot be properly set within a
database.
It is a type of lookup validation where the database will check to see if the
related record exists before allowing it to be entered.
If the related record does not exist, then the database will prevent the foreign
key data from being entered.
This is important for maintaining the accuracy of the data within the database.
If details of which classes you attend were entered into a database, but those
classes did not exist, then the database would not be able to give you any
information about the classes
Asfia Rahman
27 tasks
Asfia Rahman
28
Asfia Rahman
29
Asfia Rahman
30
Asfia Rahman
31
Asfia Rahman
32
Asfia Rahman
33
Asfia Rahman
34
Asfia Rahman
35
Asfia Rahman
36
Asfia Rahman
37
Asfia Rahman
38
Asfia Rahman
39
Asfia Rahman
40
Asfia Rahman
41
Asfia Rahman