1.3.2 - Databases Flashcards
What is a database?
Are structured and persistent stores of data for ease of processing i.e. on secondary storage, non-volatile.
-Easier to add, delete, modify and update data
-Data can be backed up and copied easier
-Multiple users, from multiple locations, can access the same database at the same time
What are fields?
A single piece of data in a record
What is a record?
A group of related fields, representing one data entry
What is a table?
A collection of records with a similar structure
What is a primary key?
A unique identifier for each record in a table. Usually, an ID number
What is a foreign key?
A field in a table that refers to the primary key in another table. Used to link tables and create relationships
What is a secondary key?
An attribute that allows a group of records in a table to be sorted and searched differently from the primary key and data to be accessed in a different order.
Basically an index that the DBMS will look for in order to find the relevant record.
What is a database management system?
Software used to manage databases. Examples include MySQL, Oracle, Microsoft SQL Server, PostgreSQL
What is a composite key?
A combination of (2 or more) fields that is unique for all records
What is a flat-file database?
These are simple data structure tables that are easy to maintain as only a limited amount of data is stored.
They are of limited use because they may have redundant and inconsistent data.
No specialist knowledge is needed to operate.
They are harder to update.
Data format is difficult to change.
What is a relational database?
Based on linked tables (relation).
Each table is based on an entity and has rows and columns.
Each row (tuple) in a table is equivalent to a record and is constructed in the same way.
Each column (attribute) is equivalent to a filed and must have just one data type.
One column or combination of columns must be the PK.
Reduces and avoids data duplication and data redundancy to save storage space.
Improves data consistency and data integrity.
Easier to change data and data format.
Data can be added more easily.
Improves levels of data security so easier to control access to data.
What is a ERD?
Entity relationship diagram, necessary when planning relational databases. Uses a diagram to show how data tables relate to each other and help with reducing redundancy (Repeated data)
What are three relationships that are used in ERDs?
One to One relationship - Makes no sense to put the data in separate tables in this case.
One to Many relationship - Used in most well-designed RDBs
Many to Many relationship - Will lead to data redundancy.
What is data redundancy?
Is unnecessary repetition of data that leads to inconsistencies
Data should have redundancy so if part of a database is lost it should be recoverable from elsewhere.
Redundancy can be provided by RAID setup or mirroring servers.
What is normalisation in databases?
A formal, methodical process to design data tables optimally.
Goes through distinct stages to lead to at least 3NF.
Resolves m-m (many to many) relationships.
Minimises repetition to reduce data redundancy.
Ensures all attributes in a table depend on one another to avoid the need to update multiple data entries when
changing a single attribute to reduce the chances of mistakes.