Lecutre 1 Flashcards

1
Q

What is a Database?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a Database Management System?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Database System

A

The DBMS software together with the data itself. Sometimes, the applications are also included

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Why don’t we “program up” databases when we need them?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Data Model

A

A set of concepts to describe the structure of a database– Structure: data types, relationships, constraints, and operations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Data model

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Database Schema

A

• 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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Instance, State

A

• 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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Three-Schema Architecture

A

• 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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Data Independence

A

• 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”;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

More on Data Independence

A

• 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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

DBMS Languages

A

• 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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Advantages of using a DBMS

A

-Representing complex relationships among data
-Efficient data access
-Supports concurrent access and crash recovery
-Data abstraction
-Data independence
-Enforcing integrity and security

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

When not to use a DBMS

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

The DBMS Marketplace

A

• 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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

People Associated with a Database

A

• Database administrator (DBA)
-Defines schemas, enforces security and authorization, maintains data availability, and recovers from failures
• Application programmers
-Write programs and make it available to the endusers
• Sophisticated users
-Use SQL to access the database interactively
• Naive users
-Invoke application programs

17
Q

Why Do We Need Transactions?

A

• It’s all about fast query response time and correctness
• DBMS is a multi-user systems
-Many different requests
-Some against same data items
• Figure out how to interleave requests to shorten response time while guaranteeing correct result
-How does DBMS know which actions belong together?
• Solution: Group database operations that must be performed together into transactions
-Either execute all operations or none

18
Q

Terminology

A

• A transaction T is a logical unit of database processing that includes one or more database access operations
• Basic database access operations: read_item (X) and write_item (X)
-Embedded within application program
-Specified interactively (e.g., via SQL)

19
Q

Sample Transaction (Informal)

A

• Example: Move $40 from checking to savings account
• To user, appears as one activity
• To database:
-Read balance of checking account: read( X)
-Read balance of savings account: read (Y)
-Subtract $40 from X
-Add $40 to Y
-Write new value of X back to disk
-Write new value of Y back to disk