Database Theory and Design Flashcards
Define a Database (DB)
An organized collection of related data
Define a Database Management System (DBMS)
Software that manages and controls access to the database
Define Database application
Program that interacts with the database at some point in its execution
Define a Database System
A collection of programs that interact with the database
What are two ways of storing and managing data?
- File-based System
- Database System
Define a File-based System
A group of software tools that help users do different tasks. Each program stores and manages its own data separately
Define a Database System
Software that helps store, manage, and organize data in an easy-to-access way. It allows users to save, update, and retrieve data quickly and securely
What are the advantages of a File-based approach?
User Control
- End user has total control of the stored data
- Can modify application or data at will
Applications and data file can be optimised for particular tasks
What are the disadvantages of a File-based approach?
- Data duplication
- Data dependence
- Incompatible file formats
- Proliferation of application programs (APPS)
What is Data Duplication
If a record is duplicated in each of the 3 files, a change to the record requires a change to all 3 files.
Integrity of student records may be compromised if the files are not all updated - which file holds the correct information.
What is Data Dependence
The way data is stored affects how it can be used, making the data and the program tightly connected
What are imcompatible file formats
If application programs are separatly implemented to data files, then the data files may be incompatible with the application program
Meaning the data files would have to be translated to fit the application program
What is the Proliferation of application programs?
If you wanted more information out of data files than initially anticipated
You would have to add more application programs to handle new queries
Leading to the proliferation of files and application programs that each official has to handle
How does a database approach address the limitation of an application program?
The data is stored in a DB, which is then accessed by DBMS.
When officials need info from the DB they write queries in SQL to communicate with the DBMS which in turn gives them what they need
What is a DBMS
Software that interacts with users’ application programs and the DB
Define a Database Management System (DBMS)
Software system that enables the user to define, create, maintain and control access to the database
What does an End-user do?
Run applications to perform specific database operations
What does an Application Developer do?
Use a programming language to provide the required functionality for the end users
What does a Database Designer do?
Ensures the database is well-organized, secure, and works efficiently
What does a Database Administrator (DBA) do?
Responsible for implementation and monitoring of the database
What are the 13 advantages of a DBMS?
- Control of data redundancy
- Data Consistency
- Sharing of data
- Improved data integrity
- Improved Security
- Enforcement of Standards
- Economy of Scale
- Balance of conflicting requirements
- Improved data accessibility and responsiveness
- Increased Productivity
- Improved maintenance through data independence
- Increased concurrency
- Backup and Recovery services
What is Control of Data Redundancy?
Since all data is now stored in a single database, there are no unnecessary multiple copies of data
What is Data Consistency?
Only one copy of each data item
(changes only have to be made to 1 item, therefore if there was multiple and they werent all changed data wouldnt be consistent)
How would an organization share data to people inside it?
Since data is common to the organization, it’s easy for all authorized users to have access to the same data
How would you improve data integrity in a database?
Organizational data is stored in one place, it’s easy to enforce consistency rules that shouldn’t be violated
How would you improve security in a database?
Database administrator can easily put in place security and access measures using the DBMS
What data standards could be enforced in a database?
Since all data is in the same database, its easy to enforce data standards such as:
- Data formats
- Naming conventions
- Documentation standards
- Update procedures
- Access rules
How is Economy of Scale used in Databases?
Combining an entire organization’s data into one database and creating a set of applications that work on this one source results in saving costs
In a database how would you balance conflicting requirements?
Since the DBA has an organizational-wide view of all operations, they can optimize the design and operational use of the database to provide the best use of resources as a whole as opposed to satisfying one department at the expense of another
What is improved data accessibility and responsiveness in a database?
Common database provides easy data access to all authorized people within orgranization
Also, the DBMS provides SQL to enable end-users to easily construct ad hoc queries without detailed programming knowledge
How could productivity be improved in a database?
Can be improved by using a DBMS, which handles low-level file operations and provides SQL for user-friendly query development, reducing the need for extensive programming.
What is improved maintenance through data independence in databases?
A DBMS separates data management from application programs
- so if changes are made to underyling data structure, the DBMS doesnt have to change application programs.
The DBMS will provide the necessary mapping between application programa and data stored on the database
What is concurrency in a database?
Many DBMSs allow users to access the database simultanoeusly without any conflict
What are Backup and recovery services in databases?
DBMS have facilities to enable data recovery following a failure
They can also automatically backup the data stored in the database
What are the disadvantages of a DBMS?
- Complex: require those using them to fully understand them
- Size: Large piece of software that requires alot of memory to run
- Cost of DBMS: Cost varies depending on if its single user or a big organization. Maintenance and operations costs also need to be factored.
- Cost of conversion: Data conversion costs as well as training and
recruiting costs - Performance: Written for general use, so some applications aren’t
as fast - Greater impact of failure: Centralization increases system vulnerability. Failure may result in everyone being affected in an organization
What are the 3 levels in Three-level Architecture?
External Level
- The way users percieve data
Conceptual Level
- Provide both the mapping and desired independence
Internal Level
- The way DBMS and the OS perceive the data
What are the two objectives of Three-level Architecture?
- Data Abstraction
- Data Independence
What is Data Abstraction?
Hide storage details and present the users with a conceptual view of the database
What is Data Independence?
ability to change the database’s internal structure (the lower levels) without impacting the higher levels, such as the applications or user interfaces that interact with the data.
What is Logical Data Independence?
The ability to change the structure of a database’s logical schema (the way data is organized and represented to users) without affecting the applications or queries that use that data.
What is Physical Data Independence?
Changing the way data is stored in a database without affecting how the data is stored or viewed by users or applications.
What is a Database schema?
The description of the structure of the database
What is a Database state?
The content of a DB at a moment in time
What is a Data model?
How data is stored, related, and accessed
A set of concepts to describe
- Data and relationships among data
- Data constraints
What are the 3 categories of Data model?
Conceptual data model
Logical data model
Physical data model
What is a Conceptual data model?
Identifies the high-level data structure
(Independent of DBMS, application programs, physical considerations)
What is a Logical data model?
Describes the data in terms of data structures
Independent of a particular DBMS product and storage technology
What are examples of Logical data models?
Hierarchical
Network
Relational
What is a Hierarchical data model?
Data is organized in a tree-like structure
Each node has 1 parent
What is a Network data model?
Data is organized as a graph
One node can have more than one parent node
What is a Relational data model
Data is stored in tables. Each table, called a relation, consists of rows and columns, much like a spreadsheet
What is a Physical data model?
Describe how data is stored in the computer, representing record structures, record openings, and access paths
Highly dependent on target DBMS
What is Motivation in Databases?
One of the most difficult aspect of database design is that designers, programmers and end-users tend to view data in different ways
Need a model for communication that is non-technical and free of ambiguities
What are the 3 main notations used for an ER Model?
- Chen Notation
- Crow’s feet Notation
- UML Notation
What does an ER Model consist of?
- Entity
- Relationship
- Attribute
- Constraint
Define an Entity.
A group of objects with the same properties
Define a Relationship.
Meaningful associations among two or more entities
Define a Degree of Relationship.
The number of participating entity types in a relationship
What are 4 Degree of Relationship types?
- Degree one: recursive
- Degree two: binary
- Degree three: ternary
- Degree four: quaternary
What is a Multiple Relationship?
Two entities are associated through more than one relationship
Define an Attribute.
A property of an entity or a relationship
Define a Candidate Key
The minimal number of attribute(s) whose value(s) uniquely identify each entity occurrence
- A candidate key cannot contain a null
Define a Primary Key
A unique identifier for each record in a database table
What are the principles of choosing a Primary key?
- Attribute length
- Minimal number of attributes required
- Future certainty of uniqueness
Do relationships have candidate keys?
NO
What is a Weak Entity Type?
Existence-dependent on some other entity
- Each entity occurrence cannot be uniquely identified using only the attributes assoicated with that entity type
Define Multiplicity
The number of possible occurrences of an entity type that may relate to a single occurrence of an associated entity type through a particular relationship
What are the 3 relationship types?
- One-to-one (1:1)
- One-to-many(1 : *)
- Many-to-many (* : *)
What is a one-to-one relationship?
Each record in one table is linked to exactly one record in another table.
What is a one-to-many relationship?
A record in one table can be linked to multiple records in another table.
What is a many-to-many relationship?
Multiple records in one table can be linked to multiple records in another table.
What is Multiplicity for complex relationships?
It’s a way of showing the “how many” in a relationship between entities
What is Cardinality?
The maximum values for the multiplicity ranges on either side of the relationship
What is Participation?
The minimum values for the multiplicity ranges on either side of the relationship
What is the difference between Optional and Mandatory Participation?
Optional (if 0)
Mandatory (if 1 or more)
What is a fan trap?
When two one-to-many relationships connect in a way that causes incorrect data interpretation.
Define Specialisation
The process of maximizing the differences between members of an entity by identifying their distinguishing characteristics
Define Generalisation
The process of minimizing the differences between entities by identifying their common characteristics
What are the participation constraints?
- Optional
- Mandatory
What are the disjoint constraints?
- And (nondisjoint)
- Or (disjoint)
Define Aggregation
An abstraction through which relationships are treated as higher-level entities
Define a Relation
A two-dimensional table that has specific characteristics
What are 4 terminologies for describing a table?
Attribute - A column that defines a specific piece of information about each record (row). Each attribute represents a data field
Tuple - A row that represents a single record or entry. Each tuple contains specific data for all the attributes (columns) in the table.
Degree - number of attributes (columns) it has
Cardinality - number of tuples (rows) it contains
What is a Candidate Key?
The minimal set of attributes whose values uniquely identify each tuple
What is a Foreign Key?
An attribute, or set of attributes, within one relation that matches the primary key of another relation
List the key properties of Relations
A relation has a name that is distinct from all other relation names in the database
Each cell of relation contains exactly one atomic (single) value
Each attribute has a distinct name
The values of an attribute are all from the same domain
Each tuple is distinct - there are no duplicate tuples
Order of attributes and tuples has no significance
Define Relation Schema
A named relation defined by the relation name (table name) and attributes
Define Relation Instance/State
A set of tuples from a relation schema
Define Entity Intregrity
Uniqueness : No two tuples can have identical values for candidate keys
Not-Null: No attribute of a candidate key can be a NULL
What is Referential Intregrity
If a foreign key exists in a relation
- Either the foreign key value matches a primary key value in its home relation
- Or the foreign key is NULL