Chap 1
Chap 1
Chap 1
Example:
create table
account (
account-number char(10),
balance integer
)
DDL Cont.
• DDL compiler generates a set of tables stored in a data dictionary
• Data dictionary contains metadata (i.e., data about data)
– Database schema
– Data storage and definition language
• Specifies the storage structure and access methods used
– Integrity constraints
• Domain constraints
• Referential integrity (references constraint in SQL)
• Assertions
– Authorization
Relational Model
• Example of tabular data in the relational model
Attributes
A Sample Relational Database
SQL
• SQL: widely used non-procedural language
– Example: Find the name of the customer with customer-
id 192-83-7465
select customer.customer_name
from customer
where customer.customer_id = ‘192-83-7465’
– Example: Find the balances of all accounts held by the
customer with customer-id 192-83-7465
select account.balance
from depositor, account
where depositor.customer_id = ‘192-83-7465’
and
depositor.account_number = account.account_number
SQL
• Application programs generally access
databases through one of
– Language extensions to allow embedded SQL
– Application program interface (e.g.,
ODBC/JDBC) which allow SQL queries to be
sent to a database
Database Design
The process of designing the general structure of the
database:
Logical Design – Deciding on the database schema. Database design
requires that we find a “good” collection of relation schemas.
– Business decision – What attributes should we record in the database?
– Computer Science decision – What relation schemas should we have
and how should the attributes be distributed among the various relation
schemas?
Physical Design – Deciding on the physical layout of the database
The Entity-Relationship Model
• Models an enterprise as a collection of
entities and relationships
– Entity: a “thing” or “object” in the enterprise
that is distinguishable from other objects
• Described by a set of attributes
– Relationship: an association among several
entities
•Represented diagrammatically by an entity-relationship diagram:
Object-Relational Data Models
• Extend the relational data model by including
object orientation and constructs to deal with
added data types.
• Allow attributes of tuples to have complex
types, including non-atomic values such as
nested relations.
• Preserve relational foundations, in particular
the declarative access to data, while extending
modeling power.
• Provide upward compatibility with existing
relational languages.
XML: Extensible Markup Language
• Defined by the WWW Consortium (W3C)
• Originally intended as a document markup
language not a database language
• The ability to specify new tags, and to create
nested tag structures made XML a great way
to exchange data, not just documents
• XML has become the basis for all new
generation data interchange formats.
• A wide variety of tools is available for
parsing, browsing and querying XML
documents/data
Storage Management
• Storage manager is a program module that provides the
interface between the low-level data stored in the database
and the application programs and queries submitted to the
system.
• The storage manager is responsible to the following tasks:
– Interaction with the file manager
– Efficient storing, retrieving and updating of data
• Issues:
– Storage access
– File organization
– Indexing and hashing
Query Processing
1.Parsing and translation
2.Optimization
3.Evaluation
Query Processing (Cont.)
• Alternative ways of evaluating a given query
– Equivalent expressions
– Different algorithms for each operation
• Cost difference between a good and a bad way of
evaluating a query can be enormous
• Need to estimate the cost of operations
– Depends critically on statistical information about
relations which the database must maintain
– Need to estimate statistics for intermediate results
to compute cost of complex expressions
Transaction Management
• A transaction is a collection of operations that
performs a single logical function in a database
application
• Transaction-management component ensures
that the database remains in a consistent (correct)
state despite system failures (e.g., power failures
and operating system crashes) and transaction
failures.
• Concurrency-control manager controls the
interaction among the concurrent transactions, to
ensure the consistency of the database.
Database Architecture
Database
Component modules of a DBMS and their interactions.
A physical centralized architecture.
History of Database Systems
• 1940's, 50's Initial use of computers as calculators. Limited data,
focus on algorithms. Science, military applications.
Introduction to Database
Systems
ANSI/SPARC Architecture
External External
External Schemas
View 1 View 2
External/Conceptual Mappings
Conceptual DBA
Conceptual Schema View
Conceptual/Internal Mapping
Introduction to Database
Systems
ASSIGNMENT 1
5th Edition
• 1.10, 1.11, 1.14, 1.15
• 2.18, 2.19 jhhjjhjjhh
Submission Date:
Wednesday, March 2, 2011.
End of Chapter 1 & 2