Databases Flashcards
What is a data model?
An abstract description of the essential data within a given context and how the data is related.
What is an entity?
A district thing about which data must be stored.
What is an attribute?
A single property of an entity.
What is an entity identifier?
An attribute, or a collection of attributes, that uniquely identifies each instance of an entity.
What is a composite entity identifier?
Multiple attributes are required to uniquely identify an instance of an entity
What do you need to know when designing a data model?
- Data that will be stored
- Real-Word entities that this data refers to
- Relationships that exist between entities
- Constraints that belong to the data
How can a data model be visually presented?
- Entity Description
- Entity-relationship diagram
What is an entity description?
Entity(Entity Identifier, Attribute, Attribute, Attribute)
What is a relationship in an E-R diagram?
Two-way association or link between two entities
What are the different types of relationships in an E-R diagram?
- One-to-Many
- Many-to-Many
- One-to-One
How are entities represented in E-R diagrams?
A rectangle with the name of the entity inside it. The name is always singular.
What is a Relational Database?
A collection of tables between which relationships are created through common attributes (primary and foreign keys)
What is a primary key?
An attribute that will uniquely identify a particular instance of an entity.
What is a composite primary key?
Two or more attributes which together uniquely identify a particular instance of an entity
What is a foreign key?
An attribute on one table which is the primary key attribute in another table
How can we store required data from a data model?
- In an OOP language
- Relational Databases
How do we turn a data model into a relational database?
Entity —> Table
Attribute —> Field
Instance of an entity —> Record
What is a Flat File Database?
- Simplest way of storing data in a text file (e.g. CSV)
- Each line represents a record, with fields separated by commas
What are the advantages and disadvantages of flat file databases?
+ Easy to create and use for small databases
- Inefficient as the data grows
How does a relational database work?
- Organises data across multiple tables
- Tables related through common fields
What are the advantages of relational databases?
- Scales better as a data set grows
- Avoids data duplication/redundancy
- Avoids data inconsistencies
What is a data dictionary?
- Description of the tables of a relational database
- Presented as a table describing one entity/table in the database
- Shows constraints on data