Professional Documents
Culture Documents
CS311 Introduction to
Database systems
“YOU CAN HAVE DATA WITHOUT
INFORMATION, BUT YOU CANNOT HAVE
INFORMATION WITHOUT DATA.”
Books
Database Management Systems, 3rd Edition - Raghu Ramakrishnan.
SQL, PL/SQL: The Programming Language Of Oracle 4th Edition - Ivan Bayross.
3
Memory
HUMAN
WHY?
Do you remember everything of your life?
We don't have to go that far:
Every single time we go out for the shopping :)
Do we remember the items we purchased in last Year?
Think:
Its about quantity of information? Or quality of information? Or Both?
Why it is essential to memorize everything?
4
Storage
WHY?
Maintains.
Students notes.
Patients information.
NADRA
Passport
Tax
What would be the best option to mark attendance, if instructor don't have any
automated attendance sheet.
Slide 1-
Basic Definitions 6
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. For
example, student grades and transcripts at a university.
Database Management System (DBMS):
A software package/system to facilitate the creation and maintenance of a
computerized database.
View level: application programs hide details of data types. Views can
also hide information (such as an employee’s salary) for security
purposes.
Rows
Sudarshan
Database Concepts 6th Edition @ Silberschatz, korth &
Language for accessing and manipulating the data organized by the appropriate data model
DML also known as query language
Here are some different DML commands:
INSERT INTO Command
This command can be used to insert data into a row of a table. I
UPDATE Command
This statement in SQL is used to update the data that is present in an existing table of a database. The UPDATE statement can
be used to update single or multiple columns on the basis of our specific needs.
DELETE Command
The DELETE statement can be used in SQL to delete various records from a given table. On the basis of the condition that has
been set in the WHERE clause, one can delete single or multiple records.
SQL (Structured Query Language) 20
The most widely used commercial language
Sudarshan
Database Concepts 6th Edition @ Silberschatz, korth &
SQL is NOT a Turing machine equivalent language
SQL is a programming language for Relational Databases.
It is designed over relational algebra and tuple relational calculus. SQL comes
as a package with all major distributions of RDBMS.
SQL comprises both data definition and data manipulation languages. Using the
data definition properties of SQL, one can design and modify database schema,
whereas data manipulation properties allows SQL to store and retrieve data
from database.
Database Design 21
The process of designing the general structure of the database:
Sudarshan
Database Concepts 6th Edition @ Silberschatz, korth &
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
Database Design (Cont.) 22
Is there any problem with this relation?
Sudarshan
Database Concepts 6th Edition @ Silberschatz, korth &
Design Approaches 23
Need to come up with a methodology to ensure that each of the relations
Sudarshan
Database Concepts 6th Edition @ Silberschatz, korth &
in the database is “good”
Two ways of doing so:
Entity Relationship Model (Chapter 7)
Models an enterprise as a collection of entities and relationships
Represented diagrammatically by an entity-relationship diagram:
Normalization Theory (Chapter 8)
Formalize what designs are bad, and test for them
24
BASIC TERMONOLOGIES RELATED TO DATABASE AND SQL
Relation: In general, a relation is a table, i.e., data is arranged in rows and columns.
Tuple: The rows of tables in a relationship are generally termed Tuples.
Attributes: The columns or fields of a table are termed Attributes.
Degree: The number of attributes in a relation determines the degree of the relation. A
relation having three attributes is said to have a relation of degree 3.
Cardinality: The number of tuples or rows in a relation is termed cardinality.
Main Characteristics of the Database Slide 1-
Approach
25
Sudarshan
Database Concepts 6th Edition @ Silberschatz, korth &
Self-describing nature of a database system:
A DBMS catalog stores the description of a particular database (e.g. data
structures, types, and constraints)
The description is called meta-data*.
This allows the DBMS software to work with different database
applications.
Insulation between programs and data:
Called program-data independence.
Allows changing data structures and storage organization without having
to change the DBMS access programs.
Database Concepts 6th Edition @ Silberschatz, korth &
Slide 1-
Sudarshan
26
Example of a Simplified Database Catalog
Main Characteristics of the Database Slide 1-
27
Approach (continued)
Sudarshan
Database Concepts 6th Edition @ Silberschatz, korth &
Data Abstraction:
A data model is used to hide storage details and present the users with a
conceptual view of the database.
Programs refer to the data model constructs rather than data storage details
Support of multiple views of the data:
Each user may see a different view of the database, which describes only the
data of interest to that user.
Main Characteristics of the Database Slide 1-
28
Approach (continued)
Sudarshan
Database Concepts 6th Edition @ Silberschatz, korth &
Sharing of data and multi-user transaction processing:
Allowing a set of concurrent users to retrieve from and to update the
database.
Concurrency control within the DBMS guarantees that each
transaction is correctly executed or aborted
Recovery subsystem ensures each completed transaction has its effect
permanently recorded in the database
OLTP (Online Transaction Processing) is a major part of database
applications. This allows hundreds of concurrent transactions to
execute per second.
Database Users Slide 1-
29
Sudarshan
Database Concepts 6th Edition @ Silberschatz, korth &
Users may be divided into
Those who actually use and control the database content, and those who design,
develop and maintain database applications (called “Actors on the Scene”), and
Those who design and develop the DBMS software and related tools, and the computer
systems operators (called “Workers Behind the Scene”).
Database Concepts 6th Edition @ Silberschatz, korth &
Slide 1-
Sudarshan
30
Database Users – Actors on the
Scene
Database Concepts 6th Edition @ Silberschatz, korth &
31
Sudarshan
Database Users – Actors on the Scene
Database Concepts 6th Edition @ Silberschatz, korth &
32
Sudarshan
Database Users – Actors on the Scene
Database Concepts 6th Edition @ Silberschatz, korth &
33
Sudarshan
Database Users – Actors on the Scene
Database Concepts 6th Edition @ Silberschatz, korth &
Slide 1-
Sudarshan
34
Database Users – Actors on the Scene
Database Users – Actors behind the Scene 35