Databases Flashcards
Flat file DB
One single table contains all the information.
Relational DB
Several linked tables, each representing an entity in the system. Each piece of data stored only once and then looked up via links from other tables. Tables and relationships between them are managed by a DBMS (DataBase Management System).
Relational (v.s. Flat File)
Avoids data redundancy (storing same data item in more than one place) and inconsistency (two versions may be different).
Advantages of ff
Simple to construct.
Disadvantages of ff
Tedious duplicate entry of data, data redundancy, inconsistency, less integrity, hard sharing data, less control over user access
Advantages of relational
Reduced data duplication and data redundancy. Improves data consistency, data integrity and security. Control access to data.
Disadvantages of relational
More complex to set up than flat file. Need a good DBMS to ensure users only see the data relevant to them.
Entity
A thing about which data is stored e.g. customer, employee, stock).
Relationship
A link between two entities (1-1, 1-many…).
Normalisation
Resolves many to many relationships and ensures data is stored in one place and in the best place.
1NF
First Normal Form requires that there be no multivalued / repeating attributes.
2NF
Second Normal Form requires that any non-key attribute be dependent on the entire key.
3NF
The rule of Third Normal Form (3NF) states that no non-key attribute can be dependent on another non-key attribute.
Showing table design
CAPITAL letters for the name of the table, Underline the key field, Overline the foreign keys.
e.g. PATIENTS (-PatientID-, Surname, Forename, Disease, WardID ).
Primary key
A unique identifier in a table. Can consist of one or more fields. If more than one field it is known as a composite primary key.