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