1.3.2 - Databases Flashcards
What is an entity?
An item of interest about which information is stored.
What is a relational database?
A set of tables whose records are linked by certain fields.
What is a flat-file database?
A flat-file database is a database that consists of a single file. It is usually based on a single entity.
How is a flat-file database written?
Entity(Attribute1, Attribute2, Attribute3)
What is a primary key?
A unique identifier for each record in a table.
How is the primary key shown?
It is underlined.
What is a foreign key?
An attribute that links two tables together.
The foreign key exists in one table as the primary key and acts as the foreign key in another.
What is a secondary key?
A non-unique but specific identifier that allows data to be searched easier.
What is the advantage of using a secondary key?
It allows for the database to be searched easier. For example, a patient will probably not know their patient ID but will know their surname.
What are the three types of entity relationships?
One-to-one
One-to-many
Many-to-many.
What is the main feature of a one-to-one entity-relationship?
One entity can be linked to only one other entity.
For example, the relationship between a husband and wife.
What is the main feature of a one-to-many entity relationship?
One entity can be associated with many other entities.
For example, a mother having multiple children.
What is the main feature of a many-to-many entity relationship?
Multiple entities can be linked to multiple entities.
For example, the relationship between students and courses.
What is normalisation?
The process of coming up with the best possible layout for a relational database.
What does normalisation try to achieve?
No redundancy.
Consistent data throughout linked tables.
Complex queries can be carried out.
Records can be added and removed without issues.
What are the three types of normalisation?
First normal form (1NF)
Second normal form (2NF)
Third normal form (3NF).
What are the conditions for first normal form?
There must be no attribute that contains more than a single value.
What are the conditions for second normal form?
It must be in first normal form.
The database must not have any partial key dependencies - no attributes depend on a composite key.