what is a database?
They are structured sets of data. They are organised in such a way that they can be easily managed, accessed, updated and analysed.
Eg. a relational database - made up of tables
what is a flat file?
The simplest form of a database - it is a single file, normally organised in a table structure with rows and columns
how would you write an entity description?
Entity1 (Attribute1, Attribute2, … )
what is a relational database?
a set of tables whose records are linked by certain fields. Each table contains data on one entity. the tables can be linked together using foreign keys (a relationship)
what is the purpose of an entity identifier?
it is used to uniquely identify the entity - it is the primary key in a relational database
What is a record?
All the fields relevant to an entity - kind of like a row in a table
what is an entity?
it is a category of object, person, event or thing of interest to an organisation, about which data is to be recorded
what is a field/attribute?
it is a property or characteristic of an entity - it is kind of like a column in a table
what is the primary key?
what is a composite primary key?
what is a secondary key?
what is a foreign key?
How can entities be related + how are they represented in an entity relationship diagram?
One-to-one:
- eg. husband + wife, country + prime minister
- shown by 2 rectangles (for entities) joined by one straight line
One-to-many:
- eg. school + pupils, mother + child
- shown by 2 rectangles joined by a straight line on one side and birds legs on the other
Many-to-many:
- avoided where possible (eg, through normalisation)
- eg. actors + films, products + components, student + course
- represented by 2 rectangles joined by birds legs on either end
what is an entity relationship diagram?
it is a diagramatic way of representing the relationships between entities in a database
how would you remove a many-to-many relationship?
eg. you have 2 tables:
- student (studentID, name, address)
- course (courseID, subject, level)
create a middleman table eg:
- student (studentID, name, address)
- enrolment (_studentID_, _courseID_)
- course (courseID, subject, level)
what is referential integrity?
no foreign key in one table can reference a non-existent record in another table - eg. can’t add a subscription for a customer if the customer ID doesnt exist in a record
what is relational database structure?
how are databases indexed?
what is normalisation?
what should a normalised database look like?
what are the properties required of a database in first normal form?
how can you make a many to many relationship into 1NF?
use a link table/middleman table
what are the features of a database in second normal form?
what are the features of a database in third normal form?