1.3.2 - Databases Flashcards
What is a Database?
A structured and persistent store of data for ease of processing; allowing for data to be:
- Retrieved quickly
- Updated easily
- Filtered for different views
What are Records
- Records are made up of fields
- Example: Person could be represented as record with fields as name, age and address
Describe a Flat-File Database
- A simple data structure table that is easy to maintain as only a limited amount of data is stored.
- They are of limited use because they may have redundant data which can waste space and leave inconsistent data.
- No specialist knowledge is needed to operate.
- They are harder to update and the data format is difficult to change.
Describe a Relational database
- Based on tables whose records are linked by certain fields (relation)
- Each table has data on one entity
- Each table has a relationship to other tables using primary and foreign keys
Benefits of a Relational Database over a Flat File Database
- Relational data allows for less redundancy of data (less repeated data)
- Relational databases improve the consistency of data
- Relational databases allow for complex queries and/or searches to be performed
Redundancy
- Redundant data is data that is repeated in a database
- A single table file is inefficient as it is full of redundant data
Primary Key
- A field that is a unique identifier for every record in that table
- Example - ID numbers
What is Concatenated Primary Key?
When more than one field is added together to form a unique primary key for a table.
Foreign Key
- Primary key in one table used as an attribute (foreign key) in another
- Provides a link between tables
- Represents many-to-one relationship
Secondary Key
An attribute that is indexed and allows a group of records to be searched for quickly; usually more memorable than PK
Different types of Entity Relationship Modelling (ERM)
- One to one
- One to many
- Many to Many
One to one relationship
- When one entity is linked to another entity
- Makes no sense to put in separate tables
One to many relationship
- When one entity is linked to several entities
- Used in most well designed RDBs
Many to many relationship
- When several entities are linked to several other entities
- Problematic; will lead to data redundancy
Database management
Handled by the database management system (DBMS) such as:
- MySQL
- Oracle
- Bigtable