UNIT 2 NOTES
DATA BASE = COLLECTION RELATED DATA STORED IN ORGANISE OR STRUCTURED AND LOGICAL
MANNER.
ORGANISE, STRUCTURED MEAN TABLE THAT CONTAIN INFORMATION
RECORD A record is all the data or information about one person or one thing.
FIELD= a 'field' is one piece of data or information about a person or thing. Field is a unit of data
about something or someone.
Field name= field name is a first name or last name.
Flat file= when we store all the information into one table.
Field length = Most databases will have a default field length set up; in this case it is 50. This means
that each text field can store up to 50 letters, numbers, or symbols.
Primary key= is a unique field that is used to identify record. We can’t repeat in primary key for e.g.,
400, 400 NO we can’t do that
Foreign key: A foreign key is used to link tables together and create a relationship. It is a field in one
table that is linked to the primary key in another table. we can repeat in foreign key for eg 400, 400
YES
In the database above there are three tables:
Artists
Recordings
Genre
The primary key in the Artists table is Artist ID
The primary key in the Genre table is Genre ID
These primary keys link to identically named fields in the Recordings table. Each of those identically
named fields are known as a 'foreign key'.
Referential integrity
Every foreign key value has a matching value in the corresponding primary key. Referential integrity
to ensure the data is accurate or trusted. Because if there is an error it could create a problem.
, Referential integrity uses these to ensure that there are no orphan records i.e., it prevents you from
deleting related records.
Referential integrity can also alert you if you try to delete a record which is related to another one.
It can also be used to cascade changes made to the database.
Compound ley=A compound / composite primary key combines more than one field to
make a unique value.
Example 1
Sometimes, a single field is not enough to uniquely identify a record.
Consider a pack of cards. There are four suits, hearts, diamonds, clubs and spades. A single
primary key would not uniquely identify a particular card based just upon the suit.
There are also thirteen values from the Ace right through to the King. Again, this would not
be sufficient to uniquely identify a card.
But, if you made a primary key out of the suit and the value, then every card in the pack
could be uniquely identified.
Example 2
A student can only be in one place at a time.
Combining the student's name, date and period gives a unique value for each record.
The three fields: student, date and period make up the compound or composite primary key
in this table.
Advantages of flat file
1. All records are stored in one place.
2. Easy to understand and configure using various standard office applications.
3. It is an excellent option for small databases.
4. It requires less hardware and software components.
DATA BASE = COLLECTION RELATED DATA STORED IN ORGANISE OR STRUCTURED AND LOGICAL
MANNER.
ORGANISE, STRUCTURED MEAN TABLE THAT CONTAIN INFORMATION
RECORD A record is all the data or information about one person or one thing.
FIELD= a 'field' is one piece of data or information about a person or thing. Field is a unit of data
about something or someone.
Field name= field name is a first name or last name.
Flat file= when we store all the information into one table.
Field length = Most databases will have a default field length set up; in this case it is 50. This means
that each text field can store up to 50 letters, numbers, or symbols.
Primary key= is a unique field that is used to identify record. We can’t repeat in primary key for e.g.,
400, 400 NO we can’t do that
Foreign key: A foreign key is used to link tables together and create a relationship. It is a field in one
table that is linked to the primary key in another table. we can repeat in foreign key for eg 400, 400
YES
In the database above there are three tables:
Artists
Recordings
Genre
The primary key in the Artists table is Artist ID
The primary key in the Genre table is Genre ID
These primary keys link to identically named fields in the Recordings table. Each of those identically
named fields are known as a 'foreign key'.
Referential integrity
Every foreign key value has a matching value in the corresponding primary key. Referential integrity
to ensure the data is accurate or trusted. Because if there is an error it could create a problem.
, Referential integrity uses these to ensure that there are no orphan records i.e., it prevents you from
deleting related records.
Referential integrity can also alert you if you try to delete a record which is related to another one.
It can also be used to cascade changes made to the database.
Compound ley=A compound / composite primary key combines more than one field to
make a unique value.
Example 1
Sometimes, a single field is not enough to uniquely identify a record.
Consider a pack of cards. There are four suits, hearts, diamonds, clubs and spades. A single
primary key would not uniquely identify a particular card based just upon the suit.
There are also thirteen values from the Ace right through to the King. Again, this would not
be sufficient to uniquely identify a card.
But, if you made a primary key out of the suit and the value, then every card in the pack
could be uniquely identified.
Example 2
A student can only be in one place at a time.
Combining the student's name, date and period gives a unique value for each record.
The three fields: student, date and period make up the compound or composite primary key
in this table.
Advantages of flat file
1. All records are stored in one place.
2. Easy to understand and configure using various standard office applications.
3. It is an excellent option for small databases.
4. It requires less hardware and software components.