Databases Flashcards
Database
An organised collection of related data
Flat file database
A database where all the data is stored in a single table.
Can be sufficient if there is a small amount of data.
Useful when data is mostly static (doesn’t change frequently)
Relational database
Where The data is held in more than one table and they are linked together using relationships.
Field
Column
Provide category headings for each item
Record
Row
A collection of data for a set of fields.
Primary key
A field that uniquely identifies each record in the table.
A table can have only one primary key. Must be unique and can’t be null.
Foreign key
A field in a table that appears as the primary key in another table. Used to join tables.
Data consistency
When a database transaction can only change data in acceptable ways - must follow pre-defined rules and constraints.
If a record is updated by a user, any user accessing this record should also receive the update.
Ensures uniformity and accuracy
Data redundancy
When there is duplication of data or unnecessary data is kept in the database.
Can happen when the same data is repeated in two or more fields, or the same field is repeated in two or more tables.
If a change is made in one place, not all the instances of the data will have the same value.
Data independence
When the database is designed in a way that reflects the natural relationships between entities and is not structured in a way that suits a specific application.
When changes are made they will not affect the existing database applications.
Data integrity
Maintaining and ensuring the reliability of the data in terms of its accuracy, completeness and consistency over its lifecycle.
Everybtable must have a primary key.
The primary key for each record must be unique and not null.
Domain integrity
Every attribute in a relational database is associated with a domain - the set of allowed values the attribute can contain.
Referential integrity
If a record is added to a table and a valuenis entered into a foreign key field, the value must exist in the primary key field of another table.
In some cases, the foreign key can be null if there is no relationship.
First normal form
Each record has a primary key
Data is atomic
Records have no repeating groups of attributes
Second normal form
No partial dependencies