Lecutre 1 Flashcards
What is a Database?
A collection of related data– Data: Known facts that can be recorded and have an implicit meaning
• Mini-world– Some part of the real world about which data is stored in a database
• A logically coherent collection of data
with some inherent meaning • Designed, built, and populated with data for a specific purpose
What is a Database Management System?
A software package that manages a database
-Supports a high-level access language (e.g. SQL)
-Supports concurrent access to very large amounts of data
• Also known as DBMS
Database System
The DBMS software together with the data itself. Sometimes, the applications are also included
Why don’t we “program up” databases when we need them?
For simple and small databases this is often the best solution
• We run into problems when:
-The structure is complicated (more than a simple table)
-The database gets large– Many people want to use it simultaneously
Data Model
A set of concepts to describe the structure of a database– Structure: data types, relationships, constraints, and operations
Data model
Conceptual data models
-High level: Provide concepts that are close to the way users perceive data
• Physical data models
-Low level: Provide concepts that describe details of how data is stored in the computer
• Implementation data models
-Provide concepts that fall between the above two, balancing user views with some computer storage details
Database Schema
• The description of a database
• Includes descriptions of the database structure and the constraints that should hold on the database
• Specified during DB design
• Not expected to change frequently
Instance, State
• Database Instance:
-The actual data stored in a database at a particular moment in time
-Also called database state (or occurrence)
• Schema vs. Instance (State):
-The database schema changes very infrequently
-Schema is also called intension
-The database state changes every time the database is updated
-State is called extension
Three-Schema Architecture
• Internal schema
-Describes data storage structures and access paths
-Typically uses a physical data model
• Conceptual schema
-Describes the structure and constraints for the whole database
-Uses a conceptual or an implementation data model
• External schema
-Describes the various user views
-Usually uses the same data model as the conceptual level
Data Independence
• Changing schema at one level of a database without having to change the schema at the next higher level
• A user of a relational database system should be able to use SQL to query the database without knowing about how precisely data is stored, e.g.
SELECT When, Where
FROM Calendar
WHERE Who = “Bill”;
More on Data Independence
• Logical data independence
-Capacity to change conceptual schema without having to change external schema or application programs
-Protects the user from changes in the logical structure of the data
• Physical data independence
-Capacity to change the internal schema without having to change the conceptual (external) schemas
-Protects the user from changes in the physical structure of data
DBMS Languages
• DDL: specifies database schema
• DML: enables users to access or manipulate data (retrieve, insert, replace, delete)– Procedural
• Describes what data is needed and how to get it
• Relational algebra
• Low-level– Non-procedural
• Describes what data is needed without specifying how to get it
• SQL • High-level
Advantages of using a DBMS
-Representing complex relationships among data
-Efficient data access
-Supports concurrent access and crash recovery
-Data abstraction
-Data independence
-Enforcing integrity and security
When not to use a DBMS
Main costs of using a DBMS:
-High initial investment and possible need for additional hardware
-Overhead for providing security, recovery, integrity, and concurrency control
• When a DBMS may be unnecessary:
-Simple, well defined, and not expected to change
-If access to data by multiple users is not required
The DBMS Marketplace
• Relational DBMS: Oracle, MySQL, IBM DB2, Microsoft SQL Server, Microsoft Access,…
• Relational companies were challenged by “objectoriented DB” companies in the 90s
• But countered with “object-relational” systems, which retain the relational core while allowing type extension as in OO systems
• Relational companies are also challenged by NoSQL companies