Databases Flashcards
What is a Relational Database
A database where data is held in tables (relations) and the tables are linked by common attributes
What is a Flat File
A database that consists of a single file. The flat file will most likely be based around a single entity and its attributes
What are the potential problems of using a flat file database
- Data might be inconsistent since data changed in one record may not be changed in another
- Space is wasted through repeated data
What is an Entity
An item of interest
What are the three types of keys
- Primary Key
- Secondry Key
- Foreign Key
What is a Primary Key
A primary key is a unique identifier for each record in the table
What a Secondary Key
- A secondary key allows a database to be searched quickly
- For example, secondary key can be set up on the surname attribute as it is unlikely someone will remember their ID but will remeber their surname it makes it easier to find specific people in the database
What is a 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
What is the name given to a key that is made up of multiple attributes
Composite key
What are the three Entity Relationship Models
- One-to-one- each entity can only be linked to one other entity, such as the relationship between a husband and wife
- One-to-many - one table can be associated with many other tables, such as a doctor having multiple patients
- Many-to-many - one entity can be associated with many other entities and the same applies the other way round. An example is customers and products - each customer can have more than one product and each product can have more than one customer
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 (unnecessary duplicates)
- Consistent data throughout linked tables
- Records can be added and removed without issues
- Complex queries can be carried out
What is First Normal Form
- No repeating fields / data
- Each record has a primary key
- Field names should only contain a single value
What is Second Normal Form
- No partial dependencies (one or more fields is depedent on only part of the primay key)
- The data must be in first normal form
What is Third Nomalisation form
- Contains no non-key dependencies (A non-key dependency means the attribute only depends on the value of the primary key and nothing else)
- The data must be in second normal form