databases Flashcards
what is a
database
an organised collection of data
organising
data in a database is
- easy adding
- ability to modify
- deletion
- searching
electronic databases =
- easy to add, retrieve, delete, update and modify data
- easy to back up
- can be accesed by multiple poeple at the same time from different locations
flat file
A flat file is a database that consists of a single file. The flat file will most likely be based around a single entity and its attributes
advantages of
flat file
- quick to set up
- require little expertise to maintain
- suitable for small amounts of data
eg: storing contact detales, playlist
drawbacks of
flat file
- take up uncessary space
- be slow to query
- become increasingly difficult to maintain
relationship
- recognisesthe differences between entities by creating different tables for each entity
- need a common field for the relationship to work
the link between two tables
Primary Key
A primary key is a unique identifier for each record in the table
Foreign Key
A foreign key is the attribute which links two tables together. The foreign key will exist in one table as the primary key and act as the foreign key in another
Secondary Key
A secondary key allows a database to be searched quickly
One-to-one
Each entity can only be linked to one other entity
relationship between a husband and wife. 1 wife to 1 husband
One-to-many
One table can be associated with many other tables, such as a mother having multiple children. Similarly, multiple child entities can be linked to the same mother entity.
Many-to-many
One entity can be associated with many other entities and the same applies the other way round. An example is students and courses - each student can enrol in more than one course and each course can have more than one student.
normalisation
The process of coming up with the best possible layout for a relational database
normalisation tries to acomplish:
No redundancy (unnecessary duplicates).
● Consistent data throughout linked tables.
● Records can be added and removed without issues.
● Complex queries can be carried out.