Level of Abstraction
Level of Abstraction
System
Database System Concepts - 6th Edition 1.2 ©Silberschatz, Korth and Sudarshan
Database Management System (DBMS)
DBMS contains information about a particular enterprise
Collection of interrelated data
Set of programs to access the data
An environment that is both convenient and efficient to use
Database Applications:
Banking: transactions
Airlines: reservations, schedules
Universities: registration, grades
Sales: customers, products, purchases
Online retailers: order tracking, customized recommendations
Manufacturing: production, inventory, orders, supply chain
Human resources: employee records, salaries, tax deductions
Databases can be very large.
Databases touch all aspects of our lives
Database System Concepts - 6th Edition 1.3 ©Silberschatz, Korth and Sudarshan
View of Data
Database System Concepts - 6th Edition 1.4 ©Silberschatz, Korth and Sudarshan
Instances and Schemas
Similar to types and variables in programming languages
Logical Schema – the overall logical structure of the database
Example: The database consists of information about a set of
customers and accounts in a bank and the relationship between them
Analogous to type information of a variable in a program
Physical schema–
schema the overall physical structure of the database
Instance – the actual content of the database at a particular point in time
Analogous to the value of a variable
Physical Data Independence – the ability to modify the physical schema
without changing the logical schema
Applications depend on the logical schema
In general, the interfaces between the various levels and components
should be well defined so that changes in some parts do not seriously
influence others.
Database System Concepts - 6th Edition 1.5 ©Silberschatz, Korth and Sudarshan
Data Models
A collection of tools for describing
Data
Data relationships
Data semantics
Data constraints
Relational model
Entity-Relationship data model (mainly for database design)
Object-based data models (Object-oriented and Object-relational)
Semistructured data model (XML)
Other older models:
Network model
Hierarchical model
Database System Concepts - 6th Edition 1.6 ©Silberschatz, Korth and Sudarshan
Relational Model
All the data is stored in various tables.
Example of tabular data in the relational model
Columns
Rows
Database System Concepts - 6th Edition 1.7 ©Silberschatz, Korth and Sudarshan
A Sample Relational Database
Database System Concepts - 6th Edition 1.8 ©Silberschatz, Korth and Sudarshan
Data Definition Language (DDL)
DDL or Data Definition Language actually consists of the SQL commands that
can be used to define the database schema. It simply deals with descriptions of
the database schema and is used to create and modify the structure of database
objects in the database.
Example:create table instructor (
ID char(5),
name varchar(20),
dept_name varchar(20),
salary numeric(8,2))
Examples of DDL commands:
CREATE – is used to create the database or its objects (like table, index,
function, views, store procedure and triggers).
DROP – is used to delete objects from the database.
ALTER-is used to alter the structure of the database.
TRUNCATE–is used to remove all records from a table, including all spaces
allocated for the records are removed.
COMMENT –is used to add comments to the data dictionary.
RENAME –is used to rename an object existing in the database.
Database System Concepts - 6th Edition 1.9 ©Silberschatz, Korth and Sudarshan
Data Manipulation Language (DML)
The SQL commands that deals with the manipulation of data
present in the database belong to DML or Data Manipulation
Language and this includes most of the SQL statements.
Examples of DML:
INSERT – is used to insert data into a table.
UPDATE – is used to update existing data within a table.
DELETE – is used to delete records from a database table.
Database System Concepts - 6th Edition 1.10 ©Silberschatz, Korth and Sudarshan