Databases Flashcards
What is a data model?
An abstract model of which things to store and what information about them should be recorded.
What is an Entity?
An object, event, person or thing about which data is to be stored
What is an attribute?
Attributes are characteristics or other information about entities
How are databases formed?
They are formed of tables which are used to store multiple entities
What is the notation for an entity description?
Entity1 (Attribute1, Attribute2 ….)
-The primary key is always underlined
Example: Patient (Title, Firstname, Surname, Address, Email)
What is an entity identifier?
- An attribute given to each entity which is unique within that table.
- Also known as the primary key.
What is a requirement of primary keys (entity identifiers)?
They must be unique
What are the three types of relationships entities can have with each other?
One-to-one
One-to-many
Many-to-many
What is an Entity relationship diagram?
They graphically represent the relationships between tables/entities in a database
What does it mean when entities have a link between them in an Entity relationship diagram?
That the two entities are related in some way,
What 2 things show a relationship in an Entity relationship diagram?
- Both the degree and the name of the relationship need to be specified
- For example: Head teacher ——————– School
The degree: One-to-one
The name: In charge of
What type of key is formed of multiple attributes, combined to form the primary key?
A composite key
What is a composite primary key?
A key formed of multiple attributes, combined to form the primary key
(also known as just a composite key)
What is a primary key?
an attribute that uniquely identifies every entity in a database
What is a foreign key?
- An attribute that is a primary key in another table
- The attribute exists in both tables
How is the primary key and foreign represented in an entity description?
-The primary key has an asterisk next to it
For example: PatientID *
-The foreign key is in italics
When is a link table used?
- It’s used to represent many-to-many relationships
- It creates a third table (the linking table) as many to many relationships are impossible to represent on a computer
What is a relational database?
A database that is formed of multiple tables that are linked together by common attributes
How is a record with a primary key quickly located?
An index of the primary key and is automatically maintained by the database software, it gives the position of every record according to its primary key
What is Normalisation?
The process used to make the design of a database the most efficient without compromising the integrity of the data
What are the advantages of normalising a database
- It allows for faster searching and sorting and saves storage space as it creates smaller tables
- They are easier to maintain.
- Data consistency is improved, reducing the number of anomalies that occur.
- Data integrity is maintained as there is no unnecessary duplication of data.
When is a database in first normal form?
If the database contains no repeating attribute/group of attributes
What does atomic mean?
It means that no single column contains more than one value
When is a database in second normal form?
- It must satisfy first normal form
- Contains no partial key dependencies
What is a partial key dependency?
When attributes depend on only one part of the primary key (only happens when the primary key is a composite primary key)
When is a database in third normal form?
- It must satisfy second normal form
- It must have no non-key dependencies
What is a non-key dependency?
Where the value of an attribute is determined by the value of another attribute which is not part of the key
What does a client server database system provide?
It provides simultaneous access to a database for multiple clients
What is concurrent access?
It’s a problem caused when multiple users attempt to access/update the same field in database at the same time
What problems can concurrent access lead to?
It can result in updates being lost if two users edit a record at the same time
What are the 4 methods for dealing with concurrent access?
- Record locks
- Serialisation
- Timestamping
- Commitment ordering
How does record locks solve the problem of concurrent access?
- When a user accesses a record, it is immediately locked to other users until the first user has finished using it.
Other users can’t access the content of a field until it has been unlocked
How does Serialisation solve the problem of concurrent access?
- Requests from other users are placed in a queue.
- Once the first user has finished, the next command in the queue is executed
How does Timestamp ordering solve the problem of concurrent access?
- When multiple commands are sent to the same field in a database, each is assigned a timestamp which marks the point in time at which the command was initiated.
- Commands are carried out on the field in the order of their timestamps.
How does Commitment ordering solve the problem of concurrent access?
- Uses an algorithm work out the optimum order in which to execute commands for a field.
- The algorithm takes into account the impact of commands on the rest of the database
- It attempts to minimise issues occuring.
What are the characteristics of serial files?
- Data is stored in the order in which it was entered
- No order to the data is maintained
- useful for storing transactional data or initialisation files
What are the characteristics of serial files?
- Store data in order of a key field
- The order is maintained when new records are added
- useful for storing master files
What is a flat file database?
A database composed of one table/file
What is a database?
Structured, persistent collections of data
What are the advantages of using databases?
- Makes processing more efficient
- Avoids redundancy
- Allows users to only see relevant data
- Saves Storage space
What do database management systems (DBSM) provide?
- Additional security, provides a centralised automatic backup
- Program/data independence
- Integrity to ensure efficiency and structure is not compromised
- A manipulation language to access/change the data
What does program/data independence mean?
- Data is separated from programs that can access it
- Advantage being that software tools that control the database can be modified without affecting the data