Databases Flashcards
What is a database?
An organised collection of data
-there are several models of data organisation, the most common being the relational mode
What is data consistency
where the database never records the same piece of information more than once
If it did, then it would lead to data inconsistency
What is bad about data being held in more than one place in a database
- leads to inconsistency
- waste of disk space
What is data redundancy
where the data doesn’t need to be held more than once and so any copies of the data are redundant
How should a database act
A database should act as a repository or pool of data, separate from the applications that deal with it.
What is data independence
the concept of keeping the data separate from the applications that use it
Means that it should be possible to write a new application with forms, reports, etc. That can connect to the data without having to change the way data is stored.
What are the properties of a flat file database
-very basic system that only allows a single table of data
What are the advantages of a flat-file database
can be useful if very simple information is being recorded
What are the disadvantages of a flat-file database over a relational database
- a relational database allows data to be held in multiple tables which have relationships between them
- a well-designed (normalised) database will not have any of the problems associated with flat-file databases
-potential inconsistency
-potential redundancy (wasting space as information is stored more than once)
-takes longer to enter information as data has to be entered more than once
Potential loss of data
What is an index
if a field is going to be regularly used as part of a search, then it can be set to indexed to allow searches to be performed much more quickly
A table can have several indexes if required
downside of an index
the more memory is required to hold each index and every time a record is added or deleted the index needs to be updated which can add a very slight delay
this is why only field which are regularly used should be indexed
What is a primary key
a field or fields that uniquely identify a record, e.g. the pin uniquely identifies a student
What would you use if no single field uniquely identifies a record
a composite primary key
e.g. in the student-subjects table on the previous slide, neither the pin nor subject id alone could be the primary key. Both are needed to identify a record and therefore the primary key would be PIN and Subject ID.
What is a foreign key
a field in a table that is the primary key in another table and is used to form a link between the two
LOOK AT ERD and entity description
do lesson 4-6 exam question video on erd for practice
What is the identifier known as in a relational database
primary key
What are the three types of relationship between entities
One-to-many
One-to-One
many-to-one
What is meant by the term database normalisation
A way of structuring data according to theoretical rules
Usually reduces data duplication / redundancy
Avoids danger of inconsistency / maintains integrity
Avoids wasting processing time
Describe 1st normal form
Makes field independent, avoids duplication of items
No repeating attributes
What is 2nd normal form
Each field depends on the whole primary key
No partial key dependencies