Computing - Databases
What is a relational database?
A method of creating a database using tables of related data.
Records in a relational database are indexed by?
A primary key.
What is an example of tables for a car rental business?
Customers
Rentals
Vehicles
What is an example of the attributes for a customer in a car rental business?
- Name
- Address
- Phone
What’s another word for tables in a relational databse?
Relations
What does one row in a table represent in a relational database?
A record.
What does one column in a table represent in a relational database?
A column.
What is a flat file database?
Where all the data is stored in one table.
In terms of customers and rentals, what is a many-to-many relationship?
Customers can rent many different cars and cars can be rented by many different customers.
What is a composite key?
A key derived from a combination of other primary keys.
What is a key from another table called?
A foreign key.
What is a foreign key?
A key from another table.
What is the focus of a database?
The elimination of redundant data.
What is the benefit of creating relationships in a database?
Changes made to one part of the database are reflected across the database as a whole.
What does this mean in databases?
One to one.
What does this mean in databases?
One to many.
What does this mean in databases?
Many to many.
What is the symbol for one to one in databases?
What is the symbol for one to many in databases?
What is the symbol for many to many in databases?
Each table holds information about what in a database?
An entity.
Wjat is normalisation?
A process used to come up with the best possible design for a database.
What are the three types of normalisation?
- 1st Normal Form
- 2nd Normal Form
- 3rd Normal Form
What is the benefit of normalisation?
Data is not duplicated over the database.
What does $2NF$ mean in databases?
2nd Normal Form.
What is first normal form?
- No repeating attributes
- Attributes are atomic
Why is a Name
column consiting of “John Doe” not atomic?
Name
column consiting of “John Doe” not atomic?Because “John Doe” can be broken down into a first name and last name.
What does it mean for data to be atomic?
It cannot be split up any more than it already has.
This database is not in first normal form. Why?
Because the table contains repeated attributes.
Is this database atomic?
Yes.
What is second normal form?
- In first normal form
- No partial dependencies
When can partial dependencies occur in a table?
When the primary key is a composite key.
Why is this table in second-normal form?
There are no attributes that are dependent on only Members
or Classes
.
If there was a column for class name, why wouldn’t the table be in second normal form?
Because class names are only relevant to the Classes
and not Members
. Therefore it’s a partial dependency.
What is third normal form?
- In second normal form
- No non-key dependencies
What’s the slogan for third normal form?
All attributes are dependent on the key, the whole key and nothing but the key.
What three things could you improve about a centralised database system?
- Server hardware
- Network
- The database software
What four techniques can you use to deal with concurrent access to a database?
- Record locking
- Table locks with serialisation
- Timestamp ordering
- Commitment ordering
What is record locking?
Using a lock to prevent concurrent access to a specific part of the database.
What are table locks with serialisation?
Where locks are used to make sure transactions occur in the order they happened.
What is timestamp ordering?
Commands are executed based on the timestamp for when the data was last written or read.
What is commitment ordering?
In general, transactions occur in the order they are recieved but transactions that cause a deadlock with be delayed.